Heat oven to 375°F. Grease a 9x13-inch baking dish with the butter.
Melt 3 tbsp butter in a medium saucepan over medium heat. Soften the onion until translucent, 3–4 minutes.
Stir in garlic and thyme. Cook 30 seconds until fragrant.
Sprinkle in flour and cook, stirring constantly, 1 minute to form a light roux.
Slowly whisk in milk, then cream. Simmer, whisking, until slightly thickened, 4–6 minutes. Season with salt, pepper, and nutmeg. Remove from heat.
Peel and thinly slice the potatoes, about 1/8 inch. Pat dry to remove excess moisture.
Layer one-third of the potatoes in the dish. Spoon over some sauce and scatter Gruyere. Repeat twice, ending with cheese on top.
Cover with foil and bake 35 minutes. Uncover and bake until bubbling, golden, and tender, 20–25 minutes more.
Rest 10–15 minutes to set. Garnish with chives and serve warm.