If you go for a ride in the morning, your body's main source of energy is glycogen stored in your leg muscles, which came from the food you ate for dinner the night before. (There is also liver glycogen, and you can burn fat, but it's a slower process.) For most people, muscle glycogen is sufficient for about 2 hours of continuous, strenuous exercise. Once glycogen is stored in a particular muscle, such as a leg muscle, it can't be taken out of that muscle for use anywhere else. (Liver glycogen can be donated to other parts of the body that need it.) This two hours is if you're really putting out your maximum effort the whole time. Most cycling isn't actually that continuously intense over long periods of time -- the bike is after all a fancy device for improving your body's efficiency. In many cases you may be able to cycle for much longer, like 4 hours or more, without running out of glycogen.
So in terms of energy available to perform muscle contractions, typically it's not really necessary to eat anything unless your ride is very long. However, it's possible to start feeling hungry even when your legs still have plenty of glycogen. Being hungry is going to make your ride unpleasant, and may have the effect of decreasing performance, since fatigue is a complicated phenomenon mediated by non-conscious parts of the central nervous system. So basically it's just what you would think based on common sense: if you're hungry, eat.
At very long distances, where muscle glycogen is in danger of getting depleted, your body will try to switch over to burning fat, but that's slow, so you'll start to feel like you're bonking. In this situation it becomes important not just to avoid hunger but to provide your body with some energy that it has some hope of digesting fast enough that it can be used for pushing the pedals. If you anticipate this kind of long ride, then you can basically eat as many carbs as possible, starting even before the ride, in hopes of being able to use the energy. However, your body doesn't do a very good job of digesting food while you're exercising, and digestion takes time. That's why people often take small amounts of carbs, spread out over time.
Different people also differ in their ability to handle food while exercising strenuously. Some people barf if they try to do it. Do whatever works for you.
The main differences between a GU and some other carb-based food like a granola bar are that the GU doesn't require chewing, and it's also conveniently packaged for use while running or riding. Basically a GU is like cake frosting (or actually maltodextrose) in a convenient package.
There seems to be pretty solid science behind the concept of carbo-loading, i.e., eating lots of carbs in the day or days before the activity. Studies have shown it increases performance by pretty hefty amounts. Probably it just helps to top off your glycogen supplies. Having that energy already digested and available as glycogen is a big win. Eating during the activity is at best a minor benefit in comparison.
And BTW please don't be like a lot of the mountain bikers on my local trail system and leave your GU wrappers on the trail!