Baking powder and baking soda are both leavener’s in recipes, however they are chemically different, so lets unfold that a little bit.
Baking powder is a mixture of baking soda, cream of tartar, and sometimes cornstarch. Baking powder is double acting. This means that the first leavening occurs when baking powder gets wet. The second leavening occurs when the baking powder is heated. Finally, since baking powder contains an acid to neutralize its baking soda, it is often used in recipes that don’t call for additional acidic ingredients.
Baking soda is a bit more complex then baking powder. If we get down to the science of things baking soda is a base. Just like the science experiment we all did in school with baking soda and vinegar, the same chemical reaction happens in baking. When a recipe calls for baking soda (base), it usually calls for some type of acid: brown sugar, lemon juice, honey, ect. You NEED acid in the recipe to react with the baking soda, which in turn creates carbon dioxide and allows your cookies to rise. If acid isn’t incorporated into the recipe then the cookie will most likely have a metallic aftertaste.
Side Note: Baking soda is strong. It’s 3-4x stronger than baking powder.
Now you may run into recipes that call for both baking powder and baking soda. The simplest answer for why, is because sometimes you need more leavening than you have acid available in the recipe. So really the main thing to remember is it’s all about balance in the recipe.