Cutting onions releases sulphur gas which causes irritation when it comes into contact with the eyes. The eyes then produce tears to dilute the irritant.