While DanMan's answer is correct in a very general sense, the answer is much more complicated and has to do with dozens of different bodily mechanisms. A few select ones are:
The Hypothalamus, a center in the brain, is connected with both hunger and satiation (feeling full). Different experiments with rats have shown that damage to different parts of the Hypothalamus results in either complete lack of apetite (rats will die of starvation) or unsatiable hunger (rats will eat whenever they can, ending up as huge blobs of fat with feet and whiskers), depending on which part is damaged. Researchers, however, think that the Hypothalamus is not the cause of hunger but rather the place where all the signals from the body are summed up as "hunger".
The digestive system: When the stomach is full, it sends signals to the brain to the effect of "I'm full." This is why diets like Slim-Fast and Herbalife work. They fill the stomach with fiber and protein, which are relatively low in calories but produce a feeling of satiation.
Hormones: This is the big one. At least two hormones are responsible for hunger. The most important one is Insulin. Insulin is responsible for the body's absorbtion of glucose (sugar). When the body produces Insulin, hunger increases, this is why eating a small candy bar will actually make you MORE hungry (Sugar hits blood, body sees that as a signal for dinner, starts producing lots of Insulin. 20 minutes later, the blood is saturated with Insulin, but the candy bar has long since been absorbed and you're ravished. ). This is also the function of aperitifs and antipasti in meals, to prepare the body for a meal by producing Insulin.
Another hormone, Leptin, is released by fat cells and plays a role in managing energy expenditure and hunger. The more you have of it, the less hungry you'll feel. My own knowledge on this is lacking, but wikipedia has a pretty comprehensive article about it.
The best way to avoid hunger, as far as I know, is to eat multiple small meals, spread out during the day. This way you keep the level of Insulin at a constant level, and avoid spikes of hunger. This is also good for diabetes and cholestrol level.
There are other factors, of course, such as stress and habit, but this should be a good starter.