From the Super Mario Wiki
The Life Mushroom (also known as Health Mushrooms) is a special type of Mushroom that makes an appearance in Super Mario Galaxy and Super Mario Galaxy 2. Their appearance is that of a mushroom with a red-colored head covered with yellow stars.
Super Mario Galaxy
In Super Mario Galaxy, when Mario collects a Life Mushroom, an extra circle containing three additional health sections will be added to his Health Meter, thereby increasing his overall health from 3 to 6. The additional three sections will all be colored green. If Mario has only 1 or 2 health sections left when he first collects the Life Mushroom, then it will also refill his Health Meter back up to three before giving him the 3 extra health sections. If at any time Mario's Health Meter drops below 4 health sections (as a result of taking damage from enemies or other obstacles up to three times without collecting a coin to regain health, for instance), his Health Meter will revert back to a maximum of just 3 sections of health, and will remain that way until Mario is able to collect another Life Mushroom.
Life Mushrooms can be found in many areas throughout the game, including hidden platforms, inside Item Crystals, chests, and appearing from ? Coins. Life Mushrooms trapped inside Item Crystals will immediately start moving away from the player once freed from the crystal by Mario's spin. In addition, Life Mushrooms can usually be found right before a boss fight, most often located somewhere within the immediate vicinity of the planet before a boss planet. In some cases, Life Mushrooms can even be acquired during a boss battle, but this is not always the case. They can also be purchased from Lumalee for 30 Star Bits, which causes the Luma to transform into a Life Mushroom for the player to collect.
Super Mario Galaxy 2
Life Mushrooms reappear in Super Mario Galaxy 2 and behave just as they did in the previous game. They appear to be much more common in this game than in the first. Unlike in Super Mario Galaxy, the player will receive an extra life for every Life Mushroom they collect after having already collected one. However, this will only work if all six health sections of Mario's Health Meter are filled when he collects another Life Mushroom. If Mario collects a Life Mushroom without having all six health sections filled, the Life Mushroom will only refill Mario's Health Meter back to six, instead of giving him an extra life. Lumalee re-appears and once again sells 1-Up Mushrooms and Life Mushrooms.