To distinguish between the two, the easiest way is to look at the waistband.  This is because yoga pants usually have a secure and thick waistband that keeps them firmly in place during physical activity, whereas leggings will usually have a much thinner elastic material at the waistband that makes them more comfortable for casual wear rather than exercising.