Garlic's pungency most likely evolved as a defense mechanism against browsing by animals, and indeed many animals--though clearly not all humans--are known to be repelled by it.
The researchers include Lindsey J. Macpherson, Michael Bandell, Samer R. Eid, SunWook Hwang, and Ardem Patapoutian of the The Scripps Research Institute; Bernhard H. Geierstanger, Veena Viswanath, Michael Bandell, SunWook Hwang, and Ardem Patapoutian of the Genomics Institute, Novartis Research Foundation; and SunWook Hwang of the College of Medicine, Korea University. The authors are supported by grants from the National Institute of Neurological Disorders and Stroke. S.R.E. is supported by a fellowship from the Swiss Foundation for Medical-Biological Stipends. A.P. is a Damon Runyon Scholar.
Lindsey Macpherson, Bernhard H. Geierstanger, Veena Viswanath, Michael Bandell, Samer R. Eid, SunWook Hwang, and Ardem Patapoutian: "The Pungency of Garlic: Activation of TRPA1 and TRPV1 in Response to Allicin." Current Biology, Vol. 15, 929?34, May 24, 2005. http://www.current-biology.com