The song was composed in 1966 and first attempted during the aborted Smile sessions. Jules Siegel has said that while using marijuana with Wilson and the "Beach Boys marijuana-consumption squad" Michael Vosse mused at how violence in their "vegetative" state could not be achieved, provoking laughter and further discussion of being a vegetable. Siegel said that this encounter was what inspired Wilson to write the song. David Leaf has said the song was based on Wilson's reported health obsession at the time. Wilson later[when?] said, "I want to turn people on to vegetables, good natural food, organic food. Health is an important element in spiritual enlightenment. But I do not want to be pompous about it, so we will engage in a satirical approach." Within 1966 conceptual art by Frank Holmes, "The Elements"" are written as text alongside visual interpretations of the "Vega-Tables" lyrics. This could imply that "Vega-Tables" was to be included as part of the elemental suite initially devised for the album. This eventually came to be so in Wilson's 2004 presentation of Smile.
Lyrics are replete with wordplay. One example appearing in demo versions of the song is the lyric "cornucopious" which can be heard as "corn-a-copious". Original versions of "Vega-Tables" notably feature an interpolated section after the verses involving Barbershop-style vocal harmonies sung by the Beach Boys as they recited the two couplets opened by the jazz scat lyric "mama says":
Recording for "Vega-Tables"/"Vegetables" spanned from October 17, 1966 (1966-10-17) through June 15, 1967 (1967-06-15). All versions of the song except for "Mama Says" feature the novel use of raw vegetable chewing as percussion. During an April session for "Vegetables", the version found on The Smile Sessions, Paul McCartney joined the Beach Boys in the studio. Al Jardine remembers that
The night before a big tour, I was out in the studio recording the vocal [for "Vegetables"] when, to my surprise, Paul McCartney walked in and joined Brian at the console. And, briefly, the two most influential musical Geminis in the world had a chance to work together. I remember waiting for long periods of time between takes to get to the next section or verse. Brian [seemed to have] lost track of the session. Paul would come on the talkback and say something like "Good take, Al."
During November 1967, the long-running sessions for "Vega-Tables" were revisited for the last time as the closing track "Mama Says" on Wild Honey (1967). This version was an extended re-recording of the unused "Vega-Tables" interpolation mentioned above.
In 1993, the initial version recorded as "Vega-Tables" for the Smile sessions was finally given an official release, along with a slew of other Smile material, on the Good Vibrations boxset. In 2011, many composite versions were made available on The Smile Sessions. A 1993 live performance of the song was released in 2013 for the compilation Made in California with Carl Wilson and Al Jardine on lead vocals.