Preheat the oven to 350°F (175°C) and grease a 9x13 inch baking dish with butter or non-stick spray.
In a skillet over medium heat, melt 1 tablespoon of butter and sauté the diced onions and apples for 5 to 7 minutes until slightly softened.
Distribute the sourdough bread cubes evenly across the bottom of the prepared baking dish.
Spread the sautéed apple and onion mixture over the bread cubes, then sprinkle 1.5 cups of the shredded cheddar cheese on top.
In a large mixing bowl, whisk together the eggs, milk, salt, black pepper, and nutmeg until the mixture is homogenous.
Pour the egg mixture slowly over the bread and cheese layers, ensuring all bread pieces are moistened.
Top the casserole with the remaining 0.5 cup of shredded cheddar cheese.
Bake for 40 to 45 minutes until the center is set and the top is golden brown.
Remove from the oven and allow the dish to rest for 10 minutes before slicing and serving.