Preheat your oven to 375°F (190°C). Grease the baking dish with butter or cooking spray.
Peel the sweet potatoes and slice them thinly using a mandoline slicer or a sharp knife to achieve even thickness.
In a saucepan over medium heat, combine the heavy cream, milk, minced garlic, salt, black pepper, and nutmeg. Heat until just simmering, stirring occasionally.
Layer half of the sweet potato slices in the bottom of the greased baking dish. Pour half of the cream mixture over the sweet potatoes, then sprinkle with 1 cup of shredded cheddar cheese.
Add the remaining sweet potato slices on top, and pour the rest of the cream mixture over them. Finish by topping with the remaining 1 cup of shredded cheddar cheese.
Cover the baking dish with aluminum foil and place it in the preheated oven. Bake for 40 minutes.
After 40 minutes, remove the foil and bake for an additional 15 minutes, or until the top is golden brown and bubbly, and the sweet potatoes are tender when pierced with a fork.
Once cooked, let the gratin sit for about 10 minutes before serving. Garnish with fresh thyme if desired.