Step-by-step explanation:
According to the general theory of relativity, spacetime curves due to the energy it contains. Since mass is a form of energy, "create" gravity. That is, gravity is the effect observed as a consequence of the curvature of spacetime. Therefore, gravity curves the path of light because it curves the space through which light passes.