Preheat the oven to 400°F (200°C). Spread pumpkin chunks on a baking sheet, drizzle with olive oil, and toss to coat. Roast for about 30-40 minutes until the flesh is tender and slightly caramelized around the edges.
Meanwhile, warm a large pot over medium heat. Add chopped onion and cook, stirring occasionally, until it becomes translucent and fragrant, about 5 minutes.
Once the pumpkin is roasted and cooled slightly, scoop the flesh into a blender. Add a splash of vegetable broth and blend until smooth and creamy.
Add the garlic, cinnamon, and nutmeg to the cooked onions in the pot. Stir and cook for another minute until the spices are fragrant.
Pour the pumpkin puree into the pot with the onion and spice mixture. Stir well to combine everything evenly.
Gradually add the vegetable broth, stirring to incorporate the puree into a smooth soup base. Bring the mixture to a gentle simmer.
Allow the soup to simmer for about 10-15 minutes, stirring occasionally, to let the flavors meld and the soup thicken slightly.
If using, stir in the heavy cream to add richness and creaminess to the soup. Season with salt and pepper to taste.
Use an immersion blender or carefully transfer the soup to a blender to blend until completely smooth and velvety.
Return the blended soup to the pot if necessary, warm through, and adjust seasoning as needed.
Serve the soup hot, garnished with a drizzle of cream or a sprinkle of fresh herbs if desired. Enjoy the cozy, seasonal flavors.