Mass and energy are pretty much the same thing. Photons have mass.

Are you sleeping in physics class?

Edit: Anyway, to explain your question, it's that the pull of gravity is strong enough to pull the light into the black hole, even though light is very fast.