You're thinking of leg-warmers. Leggings and yoga pants are similar in that they're both form fitting, but leggings are more for casual wear while yoga pants are athletic wear.
The terms for each have changed over the years. Yoga pants used to refer to semi-stretch sweatpants that had almost bell bottoms. But now everyone calls what are actually leggings yoga pants. Yoga pants are for just that, doing yoga. Leggings are for running, soccer, etc.