From the Super Mario Wiki
Beanstalks (sometimes called Magic Vines or simply Vines) are used as ladders in the Mario series. They first appeared in Super Mario Bros., and remain dormant inside ? Blocks. When the player hit the blocks containing the beanstalk, a beanstalk would grow allowing the player to use it as a ladder. Most beanstalks have Piranha Plants as their heads while they are growing. The head disappears when the vine is fully grown.
Super Mario series
Super Mario Bros.
Beanstalks first appear in Super Mario Bros. where they are activated to reach secret places such as Coin Heaven and Warp Zones. In World 8-2 of Super Mario Bros.: The Lost Levels, a beanstalk is required to reach the end of the level.
Super Mario Bros. 2
In Super Mario Bros. 2, the stalks are already grown in the level and do not need to be activated.
Super Mario Bros. 3
In Super Mario Bros. 3 they match the color scheme of the world they are located in; brown for World 2, green for Worlds 3 and 4, blue for World 5, and white for World 6. One notable feature about the All-Stars and Advance versions is that the top of Beanstalks resemble Piranha Plant heads, a trait that continued in the rest of the series.
Super Mario World
In Super Mario World, Beanstalks return to being green, and some grow toward breakable blocks. If Mario removes the blocks the stalk can continue rising, making shortcuts available. If the player is carrying an item such as a P Switch, the stalk cannot be climbed normally. The player can kick the item up, start to climb the Beanstalk, and then hold the Y button again to catch the item coming down while climbing. Like Jumping Piranha Plants, buds will change into pumpkins after the player completes Funky.
New Super Mario Bros./New Super Mario Bros. 2
Beanstalks later appear in New Super Mario Bros.. In this game, they can grow downwards if the character hit the block containing the beanstalk from above with a ground pound. Beanstalks can also grow upwards if hit normally. Here, unlike Super Mario Bros. 3 and Super Mario World, the top of the Beanstalk still looks like a Piranha Plant, but the sprite isn't identical to the regular Piranha Plant's sprite. Also, all tips of the Beanstalks are red, to look more like a Piranha Plant. Their stems also have a twisted appearance in the game.
In New Super Mario Bros. 2, Beanstalks make a return, where they have their New Super Mario Bros. 2 appearance.
New Super Mario Bros. Wii
Beanstalks return in New Super Mario Bros. Wii, serving the same function as in the other games, but having a slightly different appearance. The tips of the Beanstalk return to their original green appearance. They also revert to their non-twisted appearance. Also, in World 7, there's a Beanstalk on the World Map that leads the character to a back door from the World 7-Castle that takes the player right to Ludwig von Koopa. This can be accessed any time after finishing 7-6.
New Super Mario Bros. U/New Super Luigi U
Beanstalks return yet again and act like the New Super Mario Bros. Wii variant. The New Super Mario Bros. U level Skyward Stalk and the New Super Luigi U level Beanstalk Jungle, both from Sparkling Waters, contains a giant Beanstalk to reach the end of the stage.
Super Mario Maker
Beanstalks make a return in Super Mario Maker. They can be placed into stages either within or out of blocks. When used outside of blocks, players can extend their length, but when in blocks, they'll grow up until the top of the stage or up to a ceiling. They can be used in all four styles, retaining their appearances, albeit with Piranha Plant heads added to their Super Mario Bros. and Super Mario Bros. 3 sprites.
Super Mario Bros.: Peach-hime Kyushutsu Dai Sakusen!
In Super Mario Bros.: Peach-hime Kyushutsu Dai Sakusen!, a Beanstalk appears where it help Mario and the others escape the attacking Spinies.
The Super Mario Bros. Super Show!
A beanstalk appeared in The Super Mario Bros. Super Show! episode "Mario and the Beanstalk", which in itself was a spoof of Jack and the Beanstalk. The premise of the episode involved Mario and Luigi foolishly trading Princess Toadstool's Royal Cow for garbanzo beans, which the Princess rejected by sneezing them out of Mario's hand and into the soil, due to her allergy. The beans grew into a huge beanstalk overnight, which led Mario's group up into the clouds, where they discovered an enlarged King Koopa's castle.
After escaping from the castle, King Koopa summoned several Hoopsters to stop Mario and friends' progress on their way back down the beanstalk. However, the Hoopsters were quickly defeated by having freshly-picked garbanzo beans thrown at them. Upon reaching the bottom, Luigi chopped down the beanstalk with an axe, which brought King Koopa's entire castle crashing down with it.
The Adventures of Super Mario Bros. 3
Small Beanstalks could also be seen in the background of a few episodes of The Adventures of Super Mario Bros. 3. However, they were never integral to the plot of any episode.
Super Mario World television series
In the Super Mario World episode "Party Line", countless beanstalks were used as telephone lines (or rather, vines) for the Cave People of Dome City. After the concept of telephones proved to be unnecessary for the Cave People, Yoshi was given the job of eating all the vines.
A beanstalk is also an item in Super Mario World 2: Yoshi's Island and Yoshi's Island DS, having a sunflower head and small eyes in the latter game. Occasionally, when popping a ? Mark Cloud, Yoshi may uncover one of the seeds of these large, cheery plants. It then grows upwards at a very fast rate and produces ledge-like leaves while doing so. Unlike in other games, Yoshi must hop on its leaves instead of climbing it like a ladder.
Super Mario RPG: Legend of the Seven Stars
In Super Mario RPG: Legend of the Seven Stars, two beanstalks are seen. One is seen at the end of Bean Valley, and another is obtained after a side quest in Rose Town which leads to some secret items like the Lazy Shell. The multi-colored spiral vines in Nimbus Land might also count.
Mario Party 9
Beanstalks reappear in Mario Party 9 looking exactly as they were in New Super Mario Bros. Wii. In the Toad Road gameboard, a Beanstalk can be accessed landing on one of the Lucky Spaces. It takes the captain to a cloud to collect Mini Stars. Beanstalks also appear in the minigame, Growing Up where they get out of Brick Blocks as the players hit them.
Mario Kart 8
Super Smash Bros. for Wii U
The giant beanstalk from the New Super Mario Bros. U level Skyward Stalk and New Super Luigi U level Beanstalk Jungle reappear in Super Smash Bros. for Wii U as a stage hazard on all three variants of the Mushroom Kingdom U stage. Occasionally, it grows in the middle of the stage and provides extra platforms for fighters to use.