When an onion is cut, its cells rupture and release certain chemicals.
The sulfur-containing gas released from the onion reaches the eyes.
This gas irritates the eyes and causes a burning sensation.
To alleviate the irritation, the tear glands produce more fluid.
The eyes release tears to protect themselves.
The more the onion is chopped, the greater the amount of gas released.
Consequently, the eyes water while cutting an onion.