Science! Baking is a form of chemistry and changing up the variables like moisture content, fats and bake time can all contribute to the texture of a cookie. This article from King Arthur Flour does a great job of explaining some of the things that can affect cookie-baking outcomes.