When a whale dies - as it happens with all beings - , it begins to decay. The internal organs and all of the food it consumed before dying start to rot. As bacteria swoop in to decompose the animal, they generate heat and gasses that build tremendous pressure inside of the carcass. When biologists cut into the whale to remove or study it, the gas comes exploding out and can bring blood and internal organs with it. What a happy perspective of a daily job!
There are actually three gasses to blame for this phenomenon: methane, ammonia, and hydrogen sulfide. The combination smells really, really, reeeeeeeeally bad. So you can get a clue of how bad it is: methane is a by-product of digestion, ammonia is what gives cat urine its distinct pungent odor, and hydrogen sulfide is the gas that smells like rotting eggs. Yaiks.
So, next time a dead whale washes ashore near you, ask someone else to cut the carcass!