I will try to give a simplified answer here.
We used to describe gravity as a force starting back with Newton. But as more and more unexpected effects of gravity came into play we had to create a better description.
The best description we have today, General Relativity or short GR, is now over a hundred years old (published by Einstein in 1915). It has been proven with lots of experiments and with extremely high precision. I do find it slightly annoying that it is not taught in schools. Well, next year.
GR gets rid of the concept that gravity is a force. There is no hidden rubberband force pulling masses to each other. Instead mass modifies the shape of space (and time, but let us leave that aside now). A photon moves with the speed of light and follows a "straight" line in space. Because any mass modifies space, the line will no longer look straight in the normal sense. It will follow the modified "straight" line in space as the mass creates.
A photon that passes by a mass will change direction. More for a large mass and more when close. This was first demonstrated clearly by looking at stars passing behind the sun (it did take a solar eclipse to be able to measure it).
As I already said, GR is an extremely good description. It is not the "full truth" as there are things that it cannot describe. Even better descriptions will be needed, but when they will around is hard to say.