There are different theories about this. The most obvious answer is that junk food typically contains very high levels of sugar, fat and salt. These are all things that you either have taste receptors for (sugar and salt – you have taste receptor cells on your tongue for both of these) or which produce big changes in hormone levels in the blood as the food is absorbed in the gut (sugar and fat particularly). The brain therefore receives ‘signals’ when you taste and eat food, so foods affect brain chemistry and your mood.
One theory is that the high levels of refined sugar in some foods cause the level of insulin in your blood to ‘spike’ after a carbohydrate-rich meal (like a lot of fast food), and that this both makes you hungry again quicker (because insulin tells your body to store carbohydrate away quickly in cells and also convert it to fat), and makes you crave more of the same kind of food, because the ‘spike’ of insulin sends blood glucose low again and this makes you want more.
However, theories like this insulin one are probably too simple, mainly because the effects of food on your nervous system and brain are really really complicated, involving a lot of different hormones working in different ways – some controlling whether you feel hungry or full, some influencing your mood, and so on.
One American Professor, David Kessler, has had a lot of publicity for his view that the combination of sugar, fat and salt in junk food is essentially ‘worked out’ precisely to make you want more of it. You can read about him and his ideas in a newspaper article here.
One other theory is that junk food is pleasurable to eat, and therefore there is a reward in the brain whenever it is eaten. This reward is then sought out by eating more and more junk food. I think Austin has covered it quite well here. Either way, it isn’t particularly good for you.