Warm the oven to 375 degrees Fahrenheit and butter a 9x13-inch baking dish. Bring a large pot of salted water to a boil.
Blanch the green beans for 4 minutes until bright green, then move them to a bowl of ice water. Drain and pat dry.
Melt the butter in a large skillet over medium heat. Cook the onion for 3 minutes, then add the mushrooms and cook 6 to 8 minutes until golden.
Sprinkle the flour over the vegetables and stir for 1 minute. Pour in the milk slowly, whisking until smooth.
Simmer, stirring, for about 4 minutes until the sauce thickens enough to coat a spoon. Stir in the salt, pepper, and garlic powder.
Fold in the green beans and 1 cup of the fried onions. Spread the mixture into the prepared baking dish.
Bake for 20 minutes until the edges bubble. Top with the remaining 1 cup of fried onions and bake 5 minutes more until deep golden.
Rest 5 minutes before serving.