Preheat the oven to 375°F (190°C).
Cook 3 cups green beans in a large pot with abundant salted water until al dente (crisp and tender, not too soft). Drain under cold water and reserve. You can put them in a large bowl of ice water to help maintain the green color.
Melt 2 tablespoons butter in a large skillet. Sprinkle 2 tablespoons all-purpose flour and stir with a whisk until well integrated. Cook for 2 minutes, stirring constantly until you have a shiny, lightly colored paste.
Slowly pour 1 cup milk while you stir constantly over medium heat. It's important to incorporate the milk as you add it. If lumps form, break them up with a spatula. You need a smooth, lump-free sauce.
Add ¼ teaspoon salt, ¼ teaspoon black pepper, ½ teaspoon garlic powder and pinch of ground nutmeg. Mix well.
Place green beans, ⅔ cup grated cheddar cheese, and half the fried onions in a bowl.
Add the white sauce to the green bean mixture and toss to mix with a spatula.
Transfer to an 8-inch inch baking dish. Bake for 10 minutes.
Add the remaining ⅓ cup grated cheese on top and bake for 10 more minutes. Top with the remaining half of crispy onions and bake for 10 more minutes, until crisp and golden brown.
Serve immediately.
Refrigerate leftovers, covered, in the refrigerator. Reheat before eating.