Boil a large pot of salted water and cook the pasta until just al dente, then drain and set aside.
Heat olive oil in a sauté pan over medium heat, then add sliced mushrooms and cook until they release moisture and become golden brown, about 5–7 minutes.
Add minced garlic to the mushrooms and cook for another minute until fragrant.
Stir in the chopped spinach and cook until wilted, about 2–3 minutes, then season with salt and pepper to taste.
In a large mixing bowl, combine the cooked pasta with the sautéed vegetables, mixing well to evenly distribute the flavors.
Transfer the pasta mixture into a baking dish, spreading it out into an even layer.
Sprinkle shredded cheddar, grated parmesan, and a little more salt and pepper over the top.
Bake in a preheated oven at 375°F (190°C) for about 20–25 minutes, until the cheese is melted, bubbly, and golden around the edges.
Remove from the oven and let it rest for a few minutes to set, then serve warm, slices revealing a cheesy, flavorful casserole.