01 - Preheat the oven to 375°F. Lightly grease a 2-quart 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 4–5 minutes until bright green and just tender. Drain and immediately transfer to an ice bath to stop cooking. Drain again and set aside.
03 - In a large skillet over medium heat, melt butter. Add chopped onions and sauté for 2–3 minutes until translucent. Add garlic and mushrooms; cook for 5–6 minutes until mushrooms are softened and browned.
04 - Stir flour into the vegetable mixture and cook for 1 minute to form a roux. Gradually whisk in milk and broth until smooth. Bring to a simmer and cook for 3–4 minutes, stirring frequently, until thickened. Season with salt, pepper, and nutmeg.
05 - Remove skillet from heat. Fold in blanched green beans until evenly coated with the creamy mushroom sauce.
06 - Transfer the mixture to the prepared baking dish. Sprinkle half of the crispy fried onions evenly over the top.
07 - Bake for 20 minutes. Remove from oven, sprinkle with remaining fried onions, and return to oven for an additional 5 minutes until the topping is golden brown and crisp.
08 - Let the casserole cool slightly for 5–10 minutes before serving to allow the sauce to set.