Garlic is spicy because of a compound called allicin , which is produced when garlic is crushed, chopped, or chewed. Allicin is a sulfur-containing chemical that acts as a natural defense mechanism for the garlic plant. It is not present in whole, intact garlic but forms when the garlic's cells are damaged, activating an enzyme called alliinase that converts alliin (a sulfur compound) into allicin. This compound triggers a pungent, sharp sensation through specific receptors in the mouth and nose, different from the heat caused by capsaicin in chili peppers. Allicin stimulates the TRPA1 receptor, which senses irritants, causing the spicy, burning-like feeling associated with raw garlic.
The intensity of garlic's spiciness can be influenced by how it is prepared—mincing releases more allicin and thus more heat, while cooking garlic destroys allicin, making it milder or sweet. Garlic has a much higher concentration of sulfur compounds compared to related plants like onions, making it uniquely pungent and spicy.