Heat the oil in a large sauté pan over medium-high heat. Add the onion, chili pepper, and salt and sauté until onion starts to soften, about 2 minutes. Add the chicken and cook until slightly browned.
Stir in the garlic, ginger, curry powder, chili powder, cumin, turmeric, black pepper, and garam masala (if using). Cook until the chicken is evenly coated in spices, about 1 minute. Pour in the chopped tomatoes and stir to combine.
Add the sweet potatoes and coconut milk, scraping up any browned bits. Bring to a gentle boil, then reduce to a simmer. Cover and simmer for about 15 minutes, stirring occasionally. Add the spinach and cook until wilted and sweet potatoes are fork-tender, about 5 minutes more.
Turn off the heat; drizzle in lemon juice and stir in chopped cilantro. Serve hot over rice or with flatbread garnished with more cilantro if desired.