Massive things, according to Einstein's theory of relativity, bend the spacetime around them.
Light appears to be twisted when it travels through the warped spacetime of a big object because photons travel the shortest route between two places.
This means that gravity does not directly bend light by influencing photon motion; rather, the spacetime around a massive object (a black hole) is twisted, and light follows the shortest path (which is slightly curved), giving the impression that the black hole is influencing light motion.