Preheat Your Oven: Begin by preheating your oven to 375°F (190°C).
Prepare the Dish: Grease a baking dish with butter to prevent sticking.
Slice the Potatoes: Thinly slice the potatoes and layer them in the prepared baking dish.
Sauté Garlic and Onion: In a saucepan, melt the butter over medium heat. Add the diced onion and minced garlic, sauté until fragrant and soft.
Make the Cream Mixture: Pour in the heavy cream, season with salt and pepper, and let it heat until just simmering.
Combine and Pour: Pour the creamy mixture over the layered potatoes, evenly distributing it throughout.
Add Cheese: Top the dish with shredded cheese, ensuring it’s nicely covered.
Bake: Cover the baking dish with foil and bake for 45 minutes. After that, remove the foil and bake for an additional 15-20 minutes until the cheese is bubbly and golden brown.