Heat olive oil in a large pot over medium heat. Add onions and cook until translucent, about 5 minutes.
Add garlic and ginger, sautéing for another minute until fragrant.
Stir in curry powder and cumin, cooking for 30 seconds to bloom the spices.
Add sweet potato cubes and lentils, stirring to coat with the spices.
Pour in coconut milk and vegetable broth, bringing the mixture to a boil.
Reduce heat, cover, and simmer for 20-25 minutes until sweet potatoes are tender and lentils are cooked through.
If using spinach, stir it in during the last 2 minutes of cooking.
Season with salt and pepper to taste.
Garnish with fresh cilantro before serving.