Why do things stink?

and...

Why do chemicals smell?

There are two mechanisms.

Some things strongly irritate mucus membranes in the nose, eyes, and throat. Caustic chemicals such as ammonia, chlorine, and acid vapors stimulate pain sensors and make us jerk away from the odor.

But most smells are more subtle, and are detected by special cells in the nose. An odor molecule may stimulate more than one cell, and different odors can be recognized by combinations of receptors. Each olfactory cell has a nerve that sends the information to the brain. Humans have about 40 million of these cells. Dogs have 50 times as many (about 2 billion).

Humans have about 350 genes for odor receptors, and can distinguish about 10,000 different odors.

If you are exposed to a particular smell for a while, you become habituated to it, and you no longer detect it. The brain seems to be interested in new smells more than common smells, such as one’s own body odor. Women tend to have more sensitivity to odors than men do. Pregnancy enhances this effect. Our ability to detect odors falls as we age.

Our ability to smell things helps us to tell which foods are good to eat, or which foods are rotten. It keeps us away from dangerous places that have high levels of bacteria or harmful vapors.

Most of the things that smell bad are harmful to us, or indicate that something may be harmful.