From the Super Mario Wiki
A Sling Star is a miniature Launch Star object found in Super Mario Galaxy and its sequel, Super Mario Galaxy 2. Like Launch Stars, they give Mario boosts into the air. However, these do not send Mario flying into space with power. They simply give him a small fling into the air to reach other platforms, planets, and areas.
In some situations, there will be Sling Stars that will throw Mario up to a higher Launch Star, so he can use that to go to another planet; other times, the Sling Stars will bounce Mario to other nearby planets instead of farther away ones. Sometimes a Sling Star will simply fling the player into the air revealing rings of Star Bits and then quickly be brought back from the planet.