The onion cells release compounds into the air, and enzymes must follow up to alter amino acids into other compounds, causing irritation in the eye. To prevent, "crying" from an onion, try peeling the onion, then chilling the onion in the fridge for about 30 minutes. Otherwise, you can buy tearless onions.
Answer: Allicin is extraordinarily risky and, as quickly as it is produced, allicin movements through the air, reaches the membrane on our eyes, and irritates it. In response, our eyes secrete tears to clean away the allicin and we start to cry and smart.