From the Super Mario Wiki
Heart Coins are coins that appear in Yoshi's Story and can be collected for ♥. Not unlike coins in the Mario series, Heart Coins can be hidden everywhere in a stage, including in the sky and in the ground. Most of these coins, however, are very easy to acquire. Occasionally, after breaking a ? Bubble, five Heart Coins with blue shoes will appear. These Heart Coins act similar to the Stars from Super Mario World 2: Yoshi's Island and Yoshi's Island DS, as they will hop away in different directions after being freed. If the Baby Yoshi can collect all five Heart Coins before they disappear, the dinosaur will be awarded with a Melon.