Bite into a hot pepper and it feels a lot like you've taken a sip of a hot drink. How can something that's not hot in temperature produce the same reactions as something that is hot? Reactions like pain or sweating?
Why Such A Strong Reaction?
It's because although nerves in the skin can respond to different kinds of stimulation, such as pain, cold, and heat, they can also respond to chemicals.
But chemical stimulation sends confusing signals to the brain. The chemical in chili peppers that makes them hot is called capsaicin.
If capsaicin were to excite the pain receptors alone that might tell the brain you are being exposed to a dangerous extreme temperature.
But in ways that aren't completely understood, capsaicin stimulates both the temperature and pain receptors. That is, it simultaneously tells the brain that you are experiencing a modest increase in temperature as well as pain.
Your Brain Is Confused
So the brain receives confusing signals. It's not sure if you're just being exposed to moderate warmth or being burned.
So to be safe the nervous system responds to the more severe stimulus: pain. The brain tells the body to react the same as if it's being subjected to a burn, that is, pain, sweating, and flushing.
You respond to the brain's message by gulping a cool drink to quench the perceived burn.
Of course, we humans are a strange breed. We have taken a response that normally signals danger and made it pleasurable.
I guess that's no surprise, since we are also the species that bungee jumps and sky dives. Go figure.