It turns out that when you cut into an onion, you break open individual onion cells that release enzymes and amino acid sulfoxides. This forms sulfenic acid, which then reacts with the enzymes to create syn-propanethial s-oxide gas. This gas rises up from the chopped onions to meet your eyes.
When the nerves in your eyes detect syn-propanethial s-oxide gas, it sends signal to your central nervous system that feels like a burning sensation. Your nervous system then sends a signal back to the glands in your eyes telling them to release tears to wash away the irritant.
By Rory Arnold, Earth.com Staff Writer
Source: American Chemical Society