Onions spew enzymes and sulfenic acid when their skin is broken. These compounds combine to produce propanethial S-oxide, an irritating gas.
Propanethial S-oxide is a lachrymatory agent, meaning that it generates tears when it touches the eye. Propanethial S-oxide turns into sulfuric acid when it touches the water layer that covers and protects your eyeballs.
Source
I’m not a chemistry guy though.