To visualize the effect of a massive compact body on space, we need to pretend for a moment that the universe has only 2 spatial dimensions. Imagine that space is flat like a stretched, taught rubber sheet. If you were to roll a small marble across the sheet of flat space, it would move in a straight line.

But if you put a massive lead ball on a taught rubber sheet, the lead ball would warp the sheet a bit around it. And now the marble has to follow the shape of the rubber sheet rather than move in a straight line. Like the marble, light also follows the shape of the space it moves through, and so a body massive enough and compact enough will make light take a curved path around it. Golfers know this property of the putting green only too well.