If light travels the speed of light because it has no mass, then why do they say that light cannot escape a black hole because of the gravity?
The reason light cannot escape from a black hole is that (1) the escape velocity from a black hole is greater than the speed of light and (2) light, although regarded as having no mass, is in fact affected by gravitation as predicted by Einstein and proved in a famous solar eclipse observation c. 1920. This is because gravity shapes space itself and the light follows the curved space. In the case of a black hole, the curvature falls back upon the black hole, preventing the light from escaping. It’s not because of the density of the matter in the black hole, otherwise light could reflect off the surface of the black hole.