It helps to picture a bowling ball placed on an elastic tarp. The bowling ball bends the tarp down, creating a slope.
If you were to pick up a little wind-up toy that moves at a given speed, and placed it on the slope, trying to climb out of it, as you placed it closer and closer to the bowling ball, there’d be a point where the toy wouldn’t be able to climb out.
Now, imagine taking a red marker and drawing a circle on the tarp around the bowling ball at the precise distance where the wind-up toy can no longer climb out.
The bowling ball is any object with mass.
The tarp is space (in 2d).
The tarp sloping towards the ball is gravity (the gravity well).
The wind-up toy is a photon moving at light speed.
And the red line you drew, that’s what we call the event horizon.
Event horizons are not an actual thing, they’re just an arbitrary name we’ve given to the point were light can no longer escape, because, since lightspeed is the fastest speed possible, if light can’t escape, nothing else can.
As for why light cannot escape but gravity can, the example illustrates that gravity is not like magnetism, a force transmitted by a particle moving at lightspeed, but rather, it is the shape of the universe at that given point.
The tricky part of this example, is trying to imagine the whole thing happening in three dimensions rather than the tarp’s two.
Hope that helped.