The word cavalry is derived from the French word cavalerie which means horse. Historically the term cavalry has been used to represent troops mounted on horseback. After the invention of battle tanks and the decline of usage of horses in army the term started representing tanks regiments. Which army first stated to call its tanks regiments as Cavalry? And when did this happen? Why are tank regiments called cavalry but not other mechanized regiments (e.g. mechanized infantry or artillery)?
Several reasons. First and foremost, they perform the same role on the battlefield, providing a fast moving spearhead.
Second, and related, many of the units were cavalry units before getting tanks, they just exchanged their horses for tanks.
Artillery exchanged guns pulled by horses (and trucks) with self propelled guns (at least part of them, most armies still have pulled guns).
Same with infantry, where horse drawn carts and trucks were replaced in part with armoured fighting vehicles.
And those latter two are in part to "blame" on the tank. Their deployment was needed for those units to keep up with the tanks.