Because while cutting an onion, a special type of gas is released from it, which reacts with the Navami of our eyes and forms acid, due to that acid, our eyes get irritated and tears start coming out of our eyes.