|MadSci Network: Biochemistry|
Two factors contribute to the sweet taste of cooked onions. The first and most important factor is that the heat of cooking volatilizes the sulfur-containing compounds that give raw onions their sharp taste. Evaporating these compounds unmasks the naturally sweet flavor of onions. For instance you may recall the "trick" of blindfolding a person, stuffing up their nose and having them eat an onion. http://www.nationalgeographic.com/media/world/9703/nose/ Often they believe they're eating an apple. The second factor is caramelization: Browning the onion in the skillet causes "caramelization". Most people interpret the caramelized sugars as additional sweetness. For instance, compare the sweetness of an (uniced) cake crust, with the non browned interior.
Try the links in the MadSci Library for more information on Biochemistry.