Onions contain amino acid sulfoxides that form sulfenic acids in the onion cells.
Both the enzymes and the sulfenic acids are kept separately in the cells, but when you cut the onion the enzymes start mixing and produce propanethiol S-oxide, which is a volatile sulphur compound that starts wafting towards your eyes.
The gas that is emitted reacts with the water of your eyes and forms sulphuric acid. The sulphuric acid produced causes burning sensation in your eyes and this in turn leads to the tear glands secreting tears to wash your eyes out so you end up with watery eyes and crying.
It is the sulphur compound in the onions that also leave a typical odour of onions on your hands and utensils even after washing.
When I am peeling or chopping onions I wear my swimming goggles, I might look silly but I don’t cry!!.
Why does it happen?
When you cut into an onion, a powerful acid sprays up into the air.
If your eyes are in the way of the spray (which is likely if you are cutting onions), the acid, while not damaging to your skin, will cause your eyes to sting.
Immediately, your l tear glands, go into overdrive. Your eyes start to tear, and tears continue in excess until they’ve successfully gotten rid of the irritation. Cool, huh?