Wikipedia describes the green flash phenomena as:
The reason for a green flash lies in refraction of light (as in a prism) in the atmosphere: light moves more slowly in the lower, denser air than in the thinner air above, so sunlight rays follow paths that curve slightly, in the same direction as the
curvature of the Earth. Higher frequency light (green/blue) curves more than lower frequency light (red/orange), so green/blue rays from the upper limb of the settingsun remain visible after the red rays are obstructed by the curvature of the earth. Green flashes are enhanced by atmospheric inversions, which increase the density gradient in the atmosphere, and therefore increase refraction. A green flash is more likely to be seen in clear air, when more of the light from the setting sun reaches the observer without being scattered. We might expect to see a blue flash, but the blue is preferentially scattered out of our line of sight and remaining light ends up looking green.
Other great "green flash" sites are here: