01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish with butter.
02 - Place the peeled and cubed potatoes in a large pot of salted water. Bring to a boil, then reduce heat and simmer until fork-tender, about 15–18 minutes. Drain thoroughly.
03 - While the potatoes cook, heat olive oil in a large skillet over medium heat. Add the sliced onions and sauté, stirring occasionally, until golden brown and deeply caramelized, about 15–20 minutes. Add the minced garlic and cook for 1 additional minute until fragrant.
04 - Mash the drained potatoes together with the butter, warm milk, sour cream, salt, and pepper until smooth and creamy.
05 - Stir half of the cheddar and mozzarella cheeses into the mashed potatoes, then gently fold in the caramelized onions. Reserve a few tablespoons of onions for the topping if desired.
06 - Spread the potato mixture evenly in the prepared baking dish. Top with the remaining cheddar and mozzarella cheeses and any reserved caramelized onions.
07 - Bake for 25 minutes, or until the cheese is fully melted, bubbly, and lightly golden in spots.
08 - Garnish with fresh chives if desired. Serve hot directly from the oven.