Melt 3 tablespoons unsalted butter in a medium saucepan over medium heat. Add 3 tablespoons all-purpose flour, 1/2 teaspoon garlic powder, and 1/2 teaspoon onion powder, and whisk until the flour is completely absorbed, about 30 seconds. The mixture will be foamy and there should be no dry pockets of flour left.
While whisking constantly, slowly pour in 1 (12-ounce) beer and 1 cup whole milk. Bring to a simmer over medium heat, whisking often, 2 to 3 minutes. Continue to cook, whisking often, until thickened enough to coat the back of a spoon, about 5 minutes.
Reduce the heat to low. Add 1/2 teaspoon kosher salt and 8 ounces shredded sharp cheddar cheese and 4 ounces shredded Gruyère cheese a handful at a time, whisking between each addition, until the cheese is fully melted before adding more. Serve immediately.