What does this have to do with sugar? Basically, when you eat foods containing sugar, your pancreas has to release insulin to process it. If you don't eat too much, and you don't have any metabolic concerns (think diabetes), you probably won't notice anything.
But if you consume too much sugar, like from a can of soda or a sugary yogurt, your pancreas has to release a boatload of insulin. Do this often enough, and your cells start to become resistant to insulin, which raises your blood sugar levels, and can result in gaining fat.
When your blood sugar levels eventually come crashing back down, you'll feel tired and hungry -- your blood sugar's low, which activates ghrelin, a hormone that tells your body, "I'M SO HUNGRY." So when your diet contains too much sugar you get trapped in a cycle of eating lots of sugar, getting a brief sugar high, storing some sugar as fat, and craving more sugar when your blood sugar crashes.