From the Super Mario Wiki
Retrieved from "http://www.mariowiki.com/index.php?title=Giant_Star&oldid=1961757"
The Giant Star can be obtained by defeating Bowser three times in the final Bowser level, Bowser in the Sky. After being defeated, Bowser will vanish, revealing the final star, the Giant Star. By grabbing this star, Mario will transform into Wing Mario and start flying. After returning to Princess Peach's Castle, Mario then uses the Giant Star to release Princess Peach from the stained glass window she was trapped in above the entrance to the castle.
Unlike other Power Stars, the Giant Star will not increase Mario's Star total once collected; this is probably because the game isn't saved when this star is collected. This means that 121 Power Stars appear in Super Mario 64 (151 in the DS remake). This also means that the player does not have to defeat Bowser to complete the game with the maximum number of stars.