Heavy cavalry consist of powerful cavalry units, usually heavily armoured, whose primary duty unlike light cavalry is to close in on an enemy to kill. Because they are more powerful and harder to kill than light cavalry, they are ideal for situations where charging headlong into a foe's formations are necessary, such as against lighter melee infantry or foot archers. This power comes at a price, though: heavy cavalry are amongst some of the heaviest units and aren't as mobile as light cavalry. In any case, they are best teamed up with units capable of eliminating heavy infantry, their primary foil, such as light infantry or cavalry archers.
NOTE: With the exception of war elephants, heavy cavalry with a ranged attack - usually javelin cavalry - NEVER get to be able to attack at range.