Light photons have energy and duly has mass
E=mc^2 (mass times speed of light squared)


And despite traveling at 300000000 meters per second, the gravitational pull is so strong that it cannot pass by the black hole before falling too deep into it's gravity well.