Another way to think of this is to consider it from the point of view of spacetime. In this theoretical construct, a two-dimensional "x-y" plane is constructed by combining all of space on one axis, and time on the other. I know, weird, but bear with me.
The effect of gravity on everything -- light and matter both -- can be illustrated in this way. Think of spacetime as a thin rubbery sheet. Then you put a massive object, say a bowling ball, on the sheet. The ball will make a big dip or depression. See this:
The more massive the object, the deeper the "dip" made in the fabric of spacetime.
Now, consider a stream of photons of light traveling across spacetime. Because all of space has been compressed into the one dimension, the light MUST move somewhere along this warped surface (it's not free to leave the sheet; there is no definition of space in that direction). Stars, from the less massive like our Sun to the more massive like a neutron star, create these weird bent paths that the light must travel across. This slight effect on their paths can actually be detected with very sensitive gear here on Earth, and this gives a lot of credence that this idea is close to correct.
Now look at the black hole diagram. The dip is so very deep and pronounced that there is a boundary past which nothing can possibly escape, not light or anything else. This is known as the "event horizon" and is indicated on the diagram.
Why should light behave this way? Because at these extremes, defined by relativity, energy, light and matter are one and the same thing, related only by the square of the speed of light. Yep, e = mc2
This is also a good way to understand why less massive objects orbit more massive ones, like planets around stars. The star makes a "dip" in the sheet, and the planet has no choice at its speed but to go around and around like a roulette ball on the wheel, like so:
If the planet maintains its speed, it will circle at the same distance; as it slows down, it will "go down the drain".
I know this is mindbending stuff... hope it helps!