Preheat oven to 400°F. Cut top off garlic head; drizzle with oil, wrap in foil, and roast 35 minutes until soft and golden.
Meanwhile, heat 1 tablespoon butter and oil in a large skillet; cook onions over medium-low 25-30 minutes until deeply caramelized, stirring occasionally.
Cook macaroni according to package until al dente; drain and set aside.
Squeeze garlic from skins; mash to a paste.
Melt 4 tablespoons butter in a large pot over medium; whisk in flour and cook 2 minutes.
Gradually whisk in milk; simmer about 6 minutes, stirring until thickened.
Remove from heat; stir in garlic paste, cheddar, and Gruyere until melted. Add salt, pepper, and nutmeg.
Fold in macaroni and onions; transfer to a greased 9x13 dish and top with panko. Bake at 350°F for 20 minutes until golden and bubbly.