gravity bends the space through which light travels, not the light itself. Imagine a flat rubber sheet, draw a straight line, now put a heavy steel ball on the rubber sheet close to the line you have just drawn, the ball sinks down warping the sheet, see how it is now a bent line? That is what gravity does to space, pulling the light towards it.