Light is clearly affected by gravity, just think about a black hole, but light supposedly has no mass and gravity only affects objects with mass.

On the other hand, if light does have mass then doesn't mass become infinitely larger the closer to the speed of light an object travels. So this would result in light have an infinite mass which is impossible.

The source of gravity in general relativity is an object called the stress-energy tensor, which includes energy density, momentum density, energy flux, momentum flux (which includes shear stress and pressure) etc. Obviously, light has energy, so it acts gravitationally in GR. Since $E = mc^2$, we see that mass contributes an enormous amount of energy - so, massive objects have very strong gravitational fields, so that the other terms are negligible, which is why Newton's law works so well. However, they are there - so, light does have a gravitational field, even though it has zero mass.

When you think about how gravity affects light you really need to think in terms of general relativity, which describes gravity as the effect of a curved space-time on moving particles. Summarized by John Wheeler, mass tells space how to curve and space-time tells mass how to move.

When we apply this to light we start with the fact that light travels in straight lines (null geodesics). However when we have a large mass (say the Sun) it curves space around it, so our light ray will follow a straight line in this curved space-time. This path will appear bent to us and leads to the phenomena of gravitational lensing.

As an aside, this also easily answers the question of why all masses fall at the same rate (or gravitational mass equals inertial mass). Massive particles also follow geodesics (straight lines) in this curved space-time, so if I throw two objects of different masses with the same initial velocity they will follow the same geodesic through space-time, and we see this as both objects having the same acceleration.