The coins in Candy Crush Saga are actually called Gold Bars and they're used to buy moves and power-ups in the game for a specific level. However, these Gold Bars can be offered to you because you have completed a certain level or completed an achievement, otherwise you will have to buy them with real money. These are also called micro-transactions and they're found in many freemium games.
Be careful when you buy something because they can be a little expensive sometimes.