ELI5 answer: Because what makes spicy stuff smell also irritates your sinuses, so you make mucus to shield your sinuses from what bugs it.
**EDIT** More than just capsaicin irritates your sinuses. For example, if you have a lot of cumin in your food, you’ll experience the same thing for the same reason I said above.
Latest Answers