Melt the butter in a large Dutch oven or heavy-bottomed soup pot over medium heat.
Add the diced onion and carrots. Cook for 5 to 6 minutes, stirring occasionally, until the vegetables begin to soften.
Add the minced garlic and cook for 30 seconds, stirring constantly, until fragrant.
Sprinkle the flour over the vegetables. Stir continuously for 1 to 2 minutes to cook the flour and form a roux.
Slowly pour in the chicken broth or vegetable broth while whisking continuously until the mixture is smooth.
Stir in the milk. Add the broccoli, salt, black pepper, and nutmeg, if using.
Bring the soup to a gentle simmer. Reduce the heat to low or medium-low, cover partially, and cook for 12 to 15 minutes, until the broccoli and carrots are tender. Do not let the soup boil rapidly.
For a smoother soup, blend part of the soup with an immersion blender. Leave some broccoli pieces intact for texture.
Turn off the heat. Add the freshly grated sharp cheddar cheese a handful at a time, stirring after each addition until the cheese has melted smoothly.
Stir in the heavy cream, if using. Taste and adjust salt and pepper as needed.
Serve hot with extra shredded cheddar cheese, crusty bread, or garlic toast.