From the Super Mario Wiki
The Spinning Heart is a red translucent heart that slowly revolves on the ground. When Mario runs through it, the Spinning Heart will quickly replenish his Health Meter in proportion to the speed with which he runs through it. Thus, the faster he runs through it, the more health he recovers. In the remake of the game, Super Mario 64 DS, Yoshi, Luigi and Wario can also use this object to recover their own Health Meters.
These objects appear in Bob-omb Battlefield, Lethal Lava Land, Bowser in the Fire Sea, Hazy Maze Cave, Cool, Cool Mountain, Tick Tock Clock, and Bowser in the Sky, to name a few courses. They usually appear in places full of many enemies and obstacles as well.