Why do you retch when you see something disgusting?
Physiologically speaking, your body is reacting to something you have known associations learning. An extreme form of this phenomenon is seen in drug addiction.  After chronic use of a substance there are certain cues a person associates with the drug effects. Whether that be a certain group of people, a sound, a place, or an object the stimulant is eventually associated with the drug effect. After a certain amount of time a physiological reaction occurs with just the introduction to the stimulant without the drug. Often, if an addict receives a stimulation without a drug they are, at first, excited, calm, or feeling whatever the drug effects caused. But then, if no drug is received, the withdrawal effects come into play and makes the addict feel worse and crave the drug more intensely. 

Anyway, so when you see something you associate with being gross or awful, your bodies physical reaction is essentially prepping you for the event.The biological and cellular effects of associative learning are regulated in the central nervous system (brain). The main theory is that the initial effect of the stimulus is regulated by dopaminergic channels, and the learning and associations are regulated by serotonergic channels. However, it is more like a complex network of synaptic channels at work in various parts of the brain. The regions known to be apart of associative learning are the emotional cortex of the brain are the amygdala, prefrontal cortex, and hippocampus. 

For gastrointestinal upset the stimulus is most likely associated with an event that caused GI upset previously. For example, let's say you went out to a party and had too much to drink. You throw up everything you've eaten that day and you just generally feel awful and 'sick to your stomach.' Now, every time you see, smell, or taste that brand or flavor of alcohol you consumed, you immediately gag because your body is remembering the previous event and associates that stimulus with the vomiting and sick feeling. Does that make sense? Let me know if you would like more clarification.

Sources:


Drug Addiction Drug Habituation - Profiles in Science
Control of cocaine-seeking behavior by drug-associated stimuli in rats: Effects on recovery of extinguished operant-responding and extracellular dopamine levels in amygdala and nucleus accumbens
Neural and psychological mechanisms underlying appetitive learning: links to drug addiction
Physcopharmacology by: Meyer and Quenzer (ISBN 978-0-87893-510-9) (best source)