According to classical physics light was believed to travel in straight lines which does not happen at all in the point of view of modern physics. Light is composed of particles(photons) thus it can also be affected by gravitational forces. That's why if a light ray passes next to a massive body it will change its path to be curved. This is the reason why we can not see Black Holes(a very very dense collapsing star that has a very high gravitational force. They will be discussed later) as they trap light inside them. This can be proved experimentally during a solar eclipse because you are able to see a star although it's hiding behind the sun which means that the light emitted from that star had a curved path to reach you.