Allyl propyl disulfide
Allyl propyl disulfide is an organosulfur compound with the chemical formula C3H5S2C3H7. It is a volatile pale-yellow liquid with a strong odor. It is a major component of onion oil and is used in food additives and flavors.
This substance is present in garlic and onion. When onion or garlic is sliced, the substance evaporates and causes eyes to irritate. When garlic or onion is cooked, it also evaporates, ridding them of the spicy taste, and leaving a sweet taste in them.