1630s, "a ghost, specter, disembodied spirit" (earlier as larve, c. 1600), from Latin larva (plural larvae), earlier larua "ghost, evil spirit, demon," also "mask," a word from Roman mythology, of unknown origin; de Vaan finds a possible derivation from Lar "tutelary god" (see Lares) "quite attractive semantically."
Crowded out in its original sense by the zoological use (1768) which began with Linnaeus, who applied the word to immature forms of animals that do not resemble, and thus "mask," the adult forms.
On the double sense of the Latin word, Carlo Ginzburg, among other observers of mythology and folklore, has commented on "the well-nigh universal association between masks and the spirits of the dead."
<a href="https://www.etymonline.com/word/larvi-">Etymology of larvi- by etymonline</a>
Harper, D. (n.d.). Etymology of larvi-. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/larvi-