Answer: from http://chemistry.about.com/

Both baking soda and baking powder are leavening agents, which means they are added to baked goods before cooking to produce carbon dioxide and cause them to ‘rise’. Baking powder contains baking soda, but the two substances are used under different conditions.

Baking Soda

Baking soda is pure sodium bicarbonate. When baking soda is combined with moisture and an acidic ingredient (e.g., yogurt, chocolate, buttermilk, honey), the resulting chemical reaction produces bubbles of carbon dioxide that expand under oven temperatures, causing baked goods to rise. The reaction begins immediately upon mixing the ingredients, so you need to bake recipes which call for baking soda immediately, or else they will fall flat!

Baking Powder

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.

How Are Recipes Determined?

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.

Substituting in Recipes

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.