Scientifically Onion belonging to the same family (allium) shallots, scallions, leeks and chives contain a volatile organic compound belonging to the group of chemicals known as amino-sulfoxides. Now these Oils give the distinctive flavour to the vegetable.
Peeling, cutting or crushing an onion’s tissue releases enzymes called allinases, which convert these molecules to sulfenic acids. The sulfenic acids, in turn, spontaneously rearrange to form syn-propanethial-S-oxide, the chemical that triggers the tears. Now one may ask, why garlic spares our eyes, this is because the sulfenic acid in garlic takes a different form that does not trigger the tear glands in our eyes. Contrary to popular opinion, it is the chemicals released and not odour that causes tears.
What happens when these oils are triggered in the eyes then: The front surface of the eye–the cornea–serves several purposes, among them protection against physical and chemical irritants. The cornea is densely populated with sensory fibers of the ciliary nerve, that brings touch, temperature and pain sensations from the face and front of the head. The cornea also receives a smaller number of autonomic motor fibers that activates (tear) glands. Free nerve endings detect syn-propanethial-S-oxide on the cornea and drive activity in the ciliary nerve–which the central nervous system interprets as a burning sensation–in proportion to the compound’s concentration. This nerve activity reflexively activates the autonomic fibers, which then carry a signal back to the eye ordering the lachrymal glands to wash the irritant away.