Some recipes call for baking soda, while others call for baking powder. Which ingredient is used depends on the other ingredients in the recipe. The ultimate goal is to produce a tasty product with a pleasing texture. Baking soda is basic and will yield a bitter taste unless countered by the acidity of another ingredient, such as buttermilk. You'll find baking soda in cookie recipes. Baking powder contains both an acid and a base and has an overall neutral effect in terms of taste. Recipes that call for baking powder often call for other neutral-tasting ingredients, such as milk. Baking powder is a common ingredient in cakes and biscuits.
Baking powder contains sodium bicarbonate, but it includes the acidifying agent already (cream of tartar), and also a drying agent (usually starch). Baking powder is available as single-acting baking powder and as double-acting baking powder. Single-acting powders are activated by moisture, so you must bake recipes which include this product immediately after mixing. Double-acting powders react in two phases and can stand for a while before baking. With double-acting powder, some gas is released at room temperature when the powder is added to dough, but the majority of the gas is released after the temperature of the dough increases in the oven.
You can substitute baking powder in place of baking soda (you'll need more baking powder and it may affect the taste), but you can't use baking soda when a recipe calls for baking powder. Baking soda by itself lacks the acidity to make a cake rise. However, you can make your own baking powder if you have baking soda and cream of tartar. Simply mix two parts cream of tartar with one part baking soda.
(Source: Anne Marie Helmenstine, Ph.D., All About Chemistry)