From the Super Mario Wiki
The Mushroom Universe, better known simply as the "universe," is the name of the universe that Mario lives in. Specifically, it is the dimension in which Mario's home planet, the Mushroom World, is located. Mario's native galaxy, the Grand Finale Galaxy, is also found here. A powerful intergalactic figure named Rosalina watches over and protects the entire universe from harm. This universe is one of many dimensions in the Mario series that collectively comprise the multiverse.
The Mushroom Universe was originally mentioned in an episode of The Super Mario Bros. Super Show! titled "Stars in Their Eyes," in which Mario asked "Where in the Mushroom Universe are we?" while being chased by Space Troopas. According to various sources, including the cartoon series The Adventures of Super Mario Bros. 3, the universe of the Mushroom Kingdom is a distinct but parallel dimension to the universe in which the "Real World," or Earth, resides. There exist multiple rifts in the space-time continuum (often in the form of Warp Pipes) which allow for the boundaries between dimensions to be freely transcended. For example, in the Super Mario Bros. Super Show, Mario and Luigi arrive in the Mushroom Universe after being sucked down a drain pipe in the real world.
During the events of Super Mario Galaxy, Mario visits a total of forty-two galaxies scattered across the universe. Over the course of the game, Bowser and his Koopa Troop henchmen attempt to take over the universe. Using the power of one of several Grand Stars, which he had previously stolen from Rosalina's Comet Observatory, Bowser is able to construct his own galaxy in the center of the universe. From this galaxy, Bowser had planned to rule over every region of the universe for all time, with Princess Peach by his side. Nevertheless, Bowser's scheme is eventually thwarted by Mario at the end of the game, when he rescues both Peach and the stolen Grand Star from Bowser's Galaxy Reactor.
However, the absence of the Grand Star quickly causes the large sun in the galaxy to become structurally unstable. As the sun implodes, the entire galaxy collapses upon itself, creating a massive Black Hole that threatens to engulf the entirety of the universe if left unchecked. The Lumas onboard the Comet Observatory are able to prevent the complete obliteration of the universe by flinging themselves into the center of the enormous black hole to stabilize it. The Lumas' sacrifice immediately halts the destruction of the universe and causes the black hole to violently twist and turn in space, until it finally explodes outward and reforms the entire universe anew.
In Super Mario Galaxy 2, the universe yields seven worlds and forty-nine new galaxies for Mario to explore, all of which are accessed via the Grand World Map. In this game, Bowser wields a large spaceship-like generator, with which he absorbs various parts of the universe in an attempt to create an empire more befitting of his large size. At the end of the game, Mario must confront Bowser in the center of the universe once again, where he has to prevent him from taking over the universe for a second time. After successfully making it through Bowser's Galaxy Generator unscathed, Mario engages Bowser in battle and defeats him yet again, after which Bowser is sucked into a Black Hole and the universe is restored.