If one boils an egg long enough, the yolk has a greenish tinge on the outside. The blue-green color around the yolk of hard-boiled eggs is iron (ferrous) sulfide. It is produced by a reaction between iron in the yolk and hydrogen sulfide (H2S) in the white--which is why you see it around the edge where the yolk and white join.

The iron in the yolk is attached to a yolk protein called phosvitin. In raw eggs these long molecules are folded into particular shapes (see protein folding). This gives them the physical properties for doing the job that nature intended them to do--allowing a chick to grow inside the egg. But if you boil an egg, these proteins partly denature and crosslink. This is what makes both the yolk and white go hard, and it also releases iron from the yolk phosvitin.

Similarly, hydrogen sulfide is released from sulfur-containing proteins in the egg white as they unfold during cooking. Smell a hard-boiled egg--it has a very faint whiff of hydrogen sulfide (the rotten egg smell). Rotten eggs smell far more strongly of hydrogen sulfide because microorganisms cause much more complete breakdown of the sulfur containing proteins than occurs if you just boil eggs for 10 minutes.

As the egg cools, the yolk contracts slightly and pulls a little away from the white. The blue-green iron sulfide forms at the boundary. You may have noticed a darker colour in older eggs. This is because the yolks of older eggs are slightly more alkaline, so more of the iron is released.

See also:

Source: The NewScientist, contribution by David Oakenfull and Ralph Burley