This custom has its roots in ancient symbolism, not in Mary. Throughout history and across different cultures, women have worn veils as a sign of modesty or purity. Mary is usually depicted with a veil because as a Jewish woman of the first century, she would have worn a veil anytime she went outside the home and was seen by those outside her immediate family.
Traditionally speaking, the custom of a bride wearing a veil also has its roots in the idea of modesty and purity. The veil was commonly seen as a symbol of the bride’s virginity (thus it was a big moment when the groom lifted the veil off the bride’s face for a kiss). But this symbolism did not begin with Mary.