Baking soda is sodium bicarbonate (NaHCO3) and is used in cooking as a leavening agent (as in, it helps things to rise). It does this by releasing carbon dioxide (CO2), which it does in the presence of acids, like buttermilk, vinegar, lemon juice, cream of tartar, and so on. The process is much faster at higher temperatures. Once you put your cookies in the oven, the sodium bicarbonate begins to break down and the carbon dioxide that is released makes tiny little bubbles in the batter. These tiny bubbles get trapped as the cookies bake, making them light and fluffy.