From the Super Mario Wiki
The Star Cursor is a cursor that appears on the screen in Super Mario Galaxy and its sequel. This star-shaped cursor enables Mario and Luigi to do many things, including grabbing Star Bits, stunning enemies by shooting Star Bits, activating Pull Stars, and controlling Sling Pods. When it is used to activate Pull Stars, the Star Cursor will temporarily change to a hand icon, and will change back when there are no more Pull Stars to grab. It is taken advantage of in many of the Bubble Blowing galaxies, including the Bubble Breeze Galaxy and the Bubble Blast Galaxy, where it acts as a wind blower to move the bubble along.
The Star Cursor on the screen is produced by the wireless motion sensitivity on the Wii Remote. In multiplayer Co-Star Mode, a second orange Star Cursor appears. This cursor allows a second player to perform all the tasks that the first player's Star Cursor can, along with some that it cannot. For instance, it can manipulate the environment and freeze enemy movement to aid the first player as needed. Both players pressing the button at the same time allows Mario or Luigi to do the Co-Star Super Jump special move, as explained by the in-game instructions on how to use Co-Star Mode on the game selection screen of Super Mario Galaxy. Unlike the first player's Star Cursor, the second Star Cursor will begin to spin when it is positioned over an object, item, or character in the environment that it can affect in some way. Otherwise, it will do nothing.
In Super Mario Galaxy 2, the Star Cursor is replaced by a small red dot while riding Yoshi. While the player can no longer shoot Star Bits when this dot is present, it can still be used to pick Star Bits up, as well as to point at enemies or berries that Yoshi can eat to produce Star Bits, or Flower Grapples that he can grapple on with his tongue.