Preheat the oven to 350°F (175°C). Grease a 9x13-inch baking dish with softened butter and arrange the sourdough bread cubes evenly inside.
In a large mixing bowl, whisk together eggs, whole milk, heavy cream, granulated sugar, vanilla extract, ground cinnamon, ground nutmeg, and salt until fully combined.
Pour the custard mixture over the bread cubes. Gently press the bread to soak all pieces. Let stand for at least 10 minutes or refrigerate overnight for better flavor.
Bake the casserole in the preheated oven for 40 to 45 minutes, until the top is golden brown and the center is set.
While baking, prepare the berry compote by combining mixed berries, granulated sugar, lemon juice, lemon zest, and water in a small saucepan. Simmer over medium heat for 8 to 10 minutes, stirring occasionally, until thickened.
Remove the casserole from the oven and let it rest for 10 minutes. Serve warm topped with the berry compote and optional powdered sugar or maple syrup.