A punch or other blow to the eye causes a rush of blood to the area in an attempt to repair the internal damage caused by the blow. This rush of blood pools (in this case under the eye or around it) and as the cells die doing their job they begin to pile up. This causes swelling under the skin and darkening of the area. Bam, a a black eye.