Because...sometimes they do (Occasionally the habit is seen in older horses).
Truth is, we aren't actually sure. It might be teething related, it might be play, in some cases it might indicate a nutritional deficiency (this should always be considered if it's an older horse).
It's easy to identify which foal is the culprit - it'll be the one who's tail hasn't been chewed (they can't reach their own). The usual "treatment" is to regularly wash everyone's tails with a bad tasting shampoo - that usually stops the behavior in its tracks. (If that doesn't work, some people use hot peppers, but you have to be careful to keep that away from the sensitive under-tail areas).