Why did the chicken lay a blue egg?

The answer: Because of a harmless-to-humans viral infection.

The bluish egg above was laid by an araucana, a breed of chicken native to Chile and one of two breeds well known for occasionally popping out a blue egg. Turns out, it's the result of the chicken being infected with a retrovirus — a virus that can insert its own genetic information into the host's DNA. In this case, the virus just happens to turn eggs blue.

Image: Lavender Araucana, a Creative Commons Attribution Share-Alike (2.0) image from julianjb's photostream