Vanilla is named for its shape. The Spanish name compares the long, thin pod to a sheath, and that word carries a Latin sword scabbard inside it.

Spanish vainilla means "little pod." It is a diminutive of vaina, "sheath" or "pod," which comes from Latin vagina. In classical Latin that word meant a sheath, scabbard or covering. Its anatomical sense is modern: Etymonline dates it to medical Latin of the 1680s, and notes that the Romans did not use the word that way.

The plant was well known in Mexico long before any Spanish name existed. The Totonac people of present-day Veracruz were among the first to domesticate it. The Aztecs called the fruit tlilxochitl, often translated "black flower," though Wikipedia says "black pod" is the more likely reading. They mixed vanilla with cocoa in a drink called xocolatl.

Etymonline says Europeans first met vanilla in 1521, when Hernán Cortés's soldiers were scouting southeastern Mexico. Cortés is credited with bringing vanilla and chocolate to Europe in the 1520s. Until the 1600s Europeans used vanilla mainly to flavor chocolate. Hugh Morgan, an apothecary to Elizabeth I, made vanilla sweets without any chocolate at all.

English had the word by 1662, according to Merriam-Webster, which matches Etymonline's 1660s for the pod. The flavoring sense followed by 1728. Wikipedia gives 1754, tying the word to the botanist Philip Miller's writing on the genus, but that is a later use, not the first.

Vanilla plants taken abroad long gave few pods. Wikipedia says the crop began to thrive only after 1841. That year Edmond Albius, a 12-year-old enslaved boy on Réunion, found that the flowers could be pollinated by hand.

The figurative sense came much later. By the late 1800s vanilla could stand for the plain, conventional choice, and "plain vanilla" followed by the 1940s. By the 1970s it could describe conventional sexual tastes, and Etymonline links that sense to the common choice of vanilla ice cream. It is an odd fate for a flavor that Europe once knew only as an import from Mexico.