From the Super Mario Wiki
The Blue Coin Block is an object found in Super Mario 64 and its remake Super Mario 64 DS.
When Mario finds a Blue Coin Block and Ground Pounds it, Blue Coins show up nearby. Mario has a short time to gather the Blue Coins, after which they disappear. The block cannot be reused. The amount of Blue Coins that appear varies greatly with each course, ranging from two to ten or more; if all the coins are collected, applause can be heard.
Blue Coin Blocks can enable Mario to reach 100 Coins in each course more easily, which rewards Mario with a Power Star.