There is science behind why chillies are hot and our new favourite youtube scientist, powerm1985, eats an incredibly hot scotch bonnett and while his mouth and brain melts he attempts to explain the science behind what is happening.
Before we get to the video here's a brief explanation - basically the chilli molecule capsaicinoid is picked up by the same receptor we use to taste vanilla. But the capsaicinoid tricks the neurons in the taste receptor sending a signal to the brain saying something is on fire. So the brain increases the heart rate, starts you sweating and increases endorphins etc. Interestingly, capsaicinoid is not water soluble which is why drinking water does nothing to reduce the burning sensation.
Now there's an evolutionary reason for this. Birds are not affected by chillis at all. They can eat chillis all day long and not be affected by the heat. Only mammals feel the heat. A theory for this is mammals have teeth and tend to grind/destroy seeds - which is not very good if you're a plant trying to spread yourself around. Birds, however, don't have teeth and thus the seeds pass through the bird coming out intact. We could extend this explanation out further by suggesting humans may hate the burning sensation but we LOVE the endorphins our brain releases after eating them. So in a funny way, chillis have ensured their survival by creating something humans like and want to cultivate which works out well for both species - I'm not a scientist but it is an elegant explanation as to why we haven't rid the earth of chilli plants if we found them so disagreeable.
Here's the video with a scientist on fire trying to explain it all to you: