Baking soda and baking powder are both white powders that make baked goods rise, which is exactly why they're so easy to mix up — but they're chemically different, and swapping one for the other without adjusting the recipe usually goes wrong.
Baking soda: needs an acid to work
Baking soda is pure sodium bicarbonate. On its own, it doesn't do much — it needs to react with an acidic ingredient in the recipe (buttermilk, yogurt, brown sugar, cocoa powder, citrus, vinegar) to produce the carbon dioxide bubbles that make dough or batter rise. This is why recipes using baking soda almost always include one of those acidic ingredients too — the two are working together.
Baking powder: already has its acid built in
Baking powder is baking soda combined with a dry acid (like cream of tartar) already mixed in, plus a starch to keep it stable in storage. Because the acid is already included, baking powder can leaven a batter on its own, even without an additional acidic ingredient in the recipe — which is why plain-flavored recipes without a strong acidic ingredient (like standard pancakes) typically call for baking powder, not baking soda.
Why you can't always substitute one for the other
Using baking soda in a recipe that has no acidic ingredient leaves it with nothing to react with — you'd get little to no rise, plus a slightly bitter, metallic taste from the unreacted soda. Using baking powder in place of baking soda in a recipe built around a specific acidic ingredient (like a buttermilk biscuit) can throw off the balance of flavors, since that acid was meant to be neutralized by the soda, not left to react with something else.
Some recipes use both
It's common, and not a mistake, for a recipe to call for both baking soda and baking powder — the soda reacts with an existing acidic ingredient (like brown sugar or cocoa) for flavor-balancing and some lift, while the baking powder provides additional, more reliable rise on top of that, independent of exactly how much acid is in the recipe.
Double-acting baking powder
Most baking powder sold today is "double-acting," meaning it releases gas in two stages — a small amount when it first gets wet, and the larger portion when it hits oven heat. That's why batter with baking powder can sit for a few minutes before baking without losing all its rising power, unlike a reaction that happens entirely on contact with liquid.