Pesto turns brown due to oxidization. In other words, when basil is exposed to oxygen a chemical reaction occurs. While it likely won’t make you sick, we don’t recommend eating it. Just scrape off the oxidized layer, and the pesto underneath should be fine to consume.