The desire for a means of ascending to the sky is as old as the Tower of Babel and Jacob's Ladder. Asia has the story of the branch of the Bodhi of Buddha which grows rapidly towards the sky once it is planted. Athough he is not as old as these stories, Jack, the infamous trickster and beanstalk climber, has been around for several centuries.
The first literary version of the tale, according to Peter and Iona Opie, appeared in England in the 1734 reprint of Round About our Coal-Fire: or Christmas Entertainments (1730) with the addition of the tale "Enchantment demonstrated in the Story of Jack Spriggins and the Enchanted Bean." The piece is a skit of the tale and the author demonstrates great familiarity with the traditional tale. The skit is ridiculous and makes light of the story and the society that will enjoy it.
The story does not appear in print in any form for another seventy years. Then, in 1807, it appears in two different publications: The History of Mother Twaddle, and the Marvellous Atchievements of Her Son Jack, by B. A. T. and The History of Jack and the Bean-Stalk, Printed from the Original Manuscript, Never Before Published by Benjamin Tabart. The first is a metrical rendering of the tale and considerably different in substance and events from the second story. In B.A.T's version, a servant girl lets Jack into the giant's home and gives the giant ale to fall asleep. Once the giant is asleep, Jack beheads him, marries the girl and sends for his mother. The Tabart version is the more familiar tale of the two to 21st century readers and listeners (Opies 1972).
In 1890, Joseph Jacobs recorded a version of the tale based on the oral versions he had heard as a child. He dismissed Tabart's version as a poor representation of the oral tale. Jack is a good-for-nothing trickster in Jacobs' version while Tabart provides justification for Jack's destruction of the Giant. Both versions have competed for dominance in literary retellings. When he published the Red Fairy Book in 1890, Andrew Lang favored the Tabart version. Since Jacobs' version was new to publication, Lang's decision to favor Tabart is not necessarily a vote of preference for it over Jacobs' version. You can read the Lang/Tabart version here at Jack and the Beanstalk. Katherine Briggs, a noted British folklorist of the 20th century, favored Jacobs' version. In the end, too many variants exist to label any one variant the primary text. I have chosen Jacobs' version to annotate on the site at The Annotated Jack and the Beanstalk since it is the one I grew up with myself. In my opinion, it has less literary qualities, hearkening back more directly to an oral source.
Many variations of the tale's themes exist in different countries. The English version, Jack and the Beanstalk, is the most popular and best known variation of the tale. The events causing the beanstalk to grow, as well as the motivation for stealing from and killing the giant, vary across versions, some with more "justifiable" reasoning, such as revenge. Still, Jack is a trickster and thus amoral and/or immoral in most versions. The tale has appeared primarily in north-central Europe. It has been popular in Finland and Norway. It has appeared as far away as Spain and Romania, but never in Russia or further east. It has also appeared in French tellings in Canada and on to the American Indian tribes stretching from Nova Scotia to British Columbia (Thompson 1946).