From the Super Mario Wiki
An Item Crystal is an object found exclusively in the game Super Mario Galaxy and its sequel, Super Mario Galaxy 2. They are basically crystals containing objects/a power-up that can be found in multiple areas of the levels in the two games.
During the introductory cut-scene of Super Mario Galaxy, the Airships are shown shooting crystal bits at Toads, making it a possibility that Bowser's fleet is the source of the other crystals in the game, while in the opening of Super Mario Galaxy 2, they are seen dropping from the sky during Bowser's attack on the Mushroom Kingdom. Anything hit by the crystal bits is trapped in an Item Crystal and enters a state of suspended animation. Item Crystals have fairly weak structures and can be shattered in both games by the following:
Inside them are items such as Coins, 1-Up Mushrooms, and the occasional Launch Star or Life Mushroom. There are also octahedron crystals which contain only power-ups. Most of these crystals contain Star Bits however some may even contain Lumas or Toads, who help the player out once they are freed. Item Crystals sometimes contain enemies, namely Goombas. The quantity of Star Bits obtained will average from three to ten, and most of the Item Crystals found throughout the game will contain four to six.
Additionally, there are large, rare Item Crystals that contain Power Stars. Large Item Crystals require two spins to be shattered.