01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish with butter.
02 - Place 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 potatoes cook, heat olive oil in a large skillet over medium heat. Add sliced onions and sauté, stirring occasionally, until golden brown and deeply caramelized, about 15–20 minutes. Add minced garlic and cook for 1 additional minute.
04 - Mash the drained potatoes with 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 fold in the caramelized onions. Reserve a few tablespoons of onions for the topping.
06 - Spread the potato mixture evenly into the prepared baking dish. Top with the remaining cheddar and mozzarella cheeses and the reserved caramelized onions.
07 - Bake for 25 minutes, or until the cheese is melted, bubbly, and lightly golden on top.
08 - Garnish with fresh chives if desired. Serve hot.