One of Einstein's great insights was the space and time were related to each other where you have space and you have time. Einstein says, "Actually there's only one thing which we call space-time." And then he says, "This space-time thing, it's not just the stage on which all the action plays out. It's an actor itself." Space-time can change, it can move, it can bend, and it can warp.
Einstein's theory of relativity states that space-time is like a flexible fabric. The objects embedded in it: the sun, planets, even us, warp that fabric. And the consequence of that warping is what we call gravity. The more massive the object, the more space-time is warped and the greater the gravity. The greater the gravity, the more slowly time flows.