Heat a drizzle of oil in the pan over medium-high heat and cook the onion for a few minutes. Add the chard, sprinkle with salt and pepper, and cook until the chard wilts and there is no moisture left in the pan. Transfer to a bowl, set aside.
Add the butter and flour to the pan and whisk together to make a roux. Whisk in the milk, then add the garlic and bring to a simmer. Boil for 2 minutes, whisking. Season with salt and pepper and remove from the heat.
Preheat the oven to 400° F. Spray a baking dish with oil. Spread half of the sweet potatoes in the baking dish. Top with half the beans, a sprinkle of nutmeg, half of the greens mixture, half the cheese, and half the sauce.
Layer with the rest of the potatoes, beans, greens and sauce, and top with the rest of the cheese.
Cover with tin foil and bake for about 45 minutes, then take the foil off and bake for another 15 minutes, until Golden and bubbly.
Let stand 15 minutes before serving.