Preheat your oven to 375°F (190°C).
Thoroughly wash and peel the sweet potatoes. Using a mandoline or a sharp knife, slice them thinly (about ⅛-inch thick).
In a saucepan over medium heat, combine the heavy cream, minced garlic, salt, black pepper, and ground nutmeg. Heat until just simmering, then remove from heat.
Grease the baking dish with unsalted butter, ensuring that the bottom and sides are well coated.
Begin layering the sweet potato slices in the greased dish, overlapping them slightly. Pour a portion of the cream mixture over the first layer, then sprinkle with a mix of Gruyère and cheddar cheese.
Repeat the layering process with the remaining sweet potatoes, cream, and cheese until all ingredients are used, finishing with a layer of cheese on top.
Cover the baking dish with aluminum foil and bake in the preheated oven for 30 minutes.
After 30 minutes, remove the foil and bake for an additional 15 minutes or until the top is bubbly and golden brown.
Once cooked, remove from the oven and let it sit for about 10 minutes before serving. Garnish with fresh parsley if desired.