Vain means obsessed with your own looks or abilities. Vain about her hair, a vain man, too vain to wear glasses.
The second sense is quite different and means achieving nothing: a vain attempt, a vain hope. In vain means without success — they searched in vain — and is much the commoner of the two in writing. Take somebody's name in vain means to use it disrespectfully or carelessly. Note vanity, which carries both senses, and that vain, vein and vane are three different words that sound identical.
1adjectivevainObsessed with your own looks or abilities.
“He was too vain to wear the glasses he needed.”
synonyms: conceited, self-admiring
2adjectiveachievingAchieving nothing.
“It was a vain attempt and everybody knew it at the time.”
Too few real examples of this word to estimate which sense is commonest.
vain is a quality of emptiness or conceit.
Latin vanus means empty. Vanity, vanish and vaunt all come from it, and both English senses are the same emptiness — an empty attempt and an empty person.
Proto-Indo-European
*h₁weh₂-
Latin
vānus — empty
Old French
vain
Middle English
veyn
English, today
vain
From Middle English veyn, from Old French vain, from Latin vānus (“empty”).
Etymology from Wiktionary, CC BY-SA