Both baking soda and baking powder are leaveners, used in baking to help baked goods rise. Interestingly, baking powder contains baking soda, but not the other way around. The two cannot be substituted for each other because chemically they are different, but both work in a similar was by releasing carbon dioxide to help batter rise.
Baking soda is a leavener that requires an acidic ingredient in a batter to help a baked good rise. It is also know as sodium bicarbonate. In recipes using baking soda, you will commonly find an acidic ingredient like buttermilk, yogurt, chocolate or honey. Cookie recipes typically use baking soda.
Baking powder is a leavener that does not require an acidic ingredient in a batter to help a baked good rise. It is made from a combination of baking soda, cream of tartar and corn starch. The cream of tartar is an acid, so recipes that use baking powder don't necessarily need to contain an acidic ingredient for the batter. The corn starch helps absorb any extra moisture and keeps the baking soda from acting too quickly. Cakes and biscuits are made with baking powder.
By itself, baking soda has a bitter taste, which acidic ingredients help to neutralize. Because baking powder has both basic and acidic ingredients, it has a neutral pH and thus neutral flavor. Most baking powders sold in stores are double-acting, which means the leavener starts working immediately once the ingredients are combined, and continues to work during baking. Single-acting baking powder only works, as the name suggest, once -- i.e. when you combine the ingredients. Baking soda works in the same way. So if you're making a recipe using baking soda or single-acting baking powder, be sure to get the batter in the oven fast.
You can't substitute anything for baking soda, but you can make your own baking powder -- that is, if you have baking soda, cream of tartar and corn starch in your pantry. To make 1 teaspoon of baking powder, you need 1/4 teaspoon baking soda, 1/2 teaspoon cream of tartar and 1/4 teaspoon corn starch.