Preheat the oven to 400°F.
Thoroughly wash the Swiss chard. Separate the stems from the leaves. Cut the stems into small pieces and roughly chop the leaves.
Peel and finely chop the onion and garlic.
In a pot, melt the butter. Add the garlic and onion and sauté until translucent and fragrant.
Stir in the flour and cook briefly. Gradually whisk in the milk and heavy cream, then bring to a boil.
Season with salt, pepper, and nutmeg. Let the sauce simmer over low heat for 5 minutes.
Heat the olive oil in a pan. First, sauté the Swiss chard stems for about 3 minutes, then add the leaves and sauté briefly until they wilt.
Bring the Swiss chard and sauce together, then pour everything into a casserole dish.
Sprinkle the shredded cheese on top.
Bake the casserole for about 20–25 minutes, or until golden brown.