Objects with mass warp space-time like you warp a trampoline’s
surface when you step on it. When a photon is zipping through the universe, it has to follow the bends and curves of space-time — space-time is, after all, the only thing to travel through! So when the photon encounters a massive object, its path “dips” and “rises.” If you rolled a marble along the stepped-on trampoline, its path, too, would dip and rise.
Astronomy magazine subscribers can read the full answer for free. Just make sure you're registered with the website.