A gamma ray burst hitting Earth would seriously harm the plankton that are responsible for a significant fraction of photosynthesis. That would cause a massive spike in carbon dioxide levels, potentially causing a mass extinction...and it's quite possibly already happened.
Gamma ray bursts (or GRBs) are the brightest electromagnetic events in the universe, creating unimaginable amounts of gamma radiation in narrow beams over just a few seconds. The most common type of burst is thought to occur during the final collapse of supernovas. We've yet to see such a burst in our galaxy, but the ones we've seen in more distant locales are some of the most dramatic cosmic phenomena ever observed.