This can be explained by Einstein’s theory of general relativity.

Think of a planet orbiting the sun: as the planet moves, a centripetal force acts on it, which curves the motion. Without gravity, the planet would travel in a straight line.

General relativity puts a different perspective on the situation, instead of describing the object as moving along a curve in a flat spacetime, the object is described as moving along special “lines” in a curved spacetime, which are consequence of gravitation. The spacetime curves are called geodesics, and they generalize the notion of straight lines to curved spacetime.

Light also travels along geodesics (called null geodesics), and so paths of light are also curved by gravitational force, despite the light not having any mass.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence