Historically, cavalry have been soldiers who fought while riding horses. In modern times, "cavalry" means the branch of the military that fight in armored vehicles such as tanks. They differ from the infantry in that the Infantry fight on foot.
Soldiers have fought on horses ever since people have ridden horses. Before that, they fought in chariots pulled by horses. Because horses are strong, cavalry troops can wear more armor than infantry and carry heavier weapons. Because horses are fast, cavalry can ride into battle more quickly than infantry.