01 - Preheat oven to 375°F and generously grease a 9x13-inch baking dish with butter or cooking spray.
02 - Bring a large pot of salted water to a rolling boil. Add green beans and cook for 5 minutes until bright green and just tender-crisp. Drain immediately and plunge into ice water to halt cooking. Drain again thoroughly.
03 - Melt butter in a large skillet over medium heat. Add chopped onion and sauté for 3 minutes until softened and translucent. Add garlic and sliced mushrooms; cook for 5-6 minutes until mushrooms release moisture and become golden brown.
04 - Sprinkle flour evenly over vegetable mixture, stirring constantly for 1 minute to eliminate raw flour taste. Slowly whisk in milk, vegetable broth, and heavy cream until smooth. Stir in salt, pepper, and nutmeg.
05 - Bring sauce to a gentle simmer over medium-low heat, stirring frequently to prevent scorching. Continue cooking for approximately 5 minutes until sauce coats the back of a spoon and reaches desired consistency.
06 - Add blanched green beans to the skillet, folding gently until evenly coated with creamy mushroom sauce.
07 - Transfer bean mixture to prepared baking dish, spreading evenly. Scatter crispy fried onions generously across the surface in a uniform layer.
08 - Bake uncovered for 20 minutes until sauce bubbles around edges and topping turns golden brown and crispy. If deeper color is desired, broil for 1-2 minutes at the end, watching closely to prevent burning.
09 - Allow casserole to rest at room temperature for 5 minutes before serving, which allows sauce to set slightly for easier scooping.