Super Mario Galaxy has no cheat codes. Nintendo designed it as a pure skill-and-exploration experience without built-in cheats, GameShark/Action Replay support, or console commands.
Tell me the galaxy and star name (e.g., "Buoy Base Galaxy - The Secret of Buoy Base") and I'll give a hint without spoiling the "aha!" moment.
Embrace the gravity—every fall teaches you how to fly.