Have you ever been on a ride where your heart rate was in the zone you wanted, but your legs were burning? How about the opposite....where your legs felt like they could go on all day, but your heart felt like it was going to pop out of your chest?
Welcome to cycling! The good news is that now that you have recognized both, you can begin to figure out how to manage them.
When you are riding in a really easy (low) gear, but at a fairly quick speed, your heart rate will rise. This is because you will also be pedaling at a fairly high cadence which taxes your cardiovascular system. If you shift to a higher gear, but continue at the same speed, your cadence will drop and so will your heart rate. If you shift to a still higher gear, and again maintain the same speed, your cadence will drop again. And your heart rate will do the same.
Sounds good, right? Well there is a trade off. As you continue to shift up, and lower your cadence, you rely less on your cardiovascular system and more on your muscles to maintain your speed. Pretty soon, you will start to feel the lactic acid accumulate in your legs. This is the "burn" that will eventually tire you out.
So you need to ask yourself, what is the focus of the workout. If it is to increase your cardiovascular fitness, then keep the gears low and the cadence high. (Although you want to stay within the parameters of the workout.) If the focus is to increase your power, or muscular endurance, then get in that higher gear and slow the cadence a bit.
It's a lot like a car. If you hang out in first gear your engine will rev up really fast, and you will burn lots of gas, but you won't go very fast. It requires more energy than power. But if you shift into overdrive your engine RPMs will drop, you will save gas, and you will go much faster. This requires more power and less energy.
In a race, you can use this information to your advantage. If your legs begin to burn, down shift and spin a little faster to let the lactic acid dissipate. If your heart rate is getting too high, shift up and let your legs do a little more of the work.