If photon is mass-less and gravity can interact only with matter, then how does gravity alter the trajectory of light?
It is simply not true that gravity can only interact with mass. Rather, any long-range spin-2 force interacts with all energy-momentum equally, and it source is the stress-energy-momentum tensor. That is one way to state the equivalence principle.
Note that a massive object in its own rest frame has an associated energy $E = mc^2$, which under ordinary conditions is usually much higher than any stress terms (including pressure) or momentum (outside the rest frame). Thus one can usually pretend that gravity couples to mass, but it isn't so--rather, the gravitational charge is energy, and the entire stress-energy-momentum tensor couples to the gravitational field. This is analogous to how for electromagnetism, there is electric charge, but the electric currents also make a difference.
In the weak-field limit of general relativity, one can consider the fact that light is gravitationally deflected twice as much as a naive Newtonian prediction would be (for an object at the speed of light under Newtonian mechanics, that is) as the fault of light putting a pressure in the direction of its propagation equal to its energy density. But in general, the motion of a test particle is determined by its four-velocity and the geometry of spacetime only, and the light would just be a special case of having a 'lightlike' four-velocity.
What we call "gravity" is really just the distortion of spacetime. If spacetime was completely straight, there would be zero gravity. But the existence of a massive body is one of the things that can distort spacetime, so that "straight" lines are not straight anymore. We perceive that distortion as "gravity". It is the distortion that actually generates the gravitational force of attraction.
For a very crude analogy, imagine a lemon. As long as you're not squeezing it, the juice stays put, because no force is exerted on it. But when you squeeze the lemon, distorting its structure, juice starts moving around inside. The lemon is spacetime. The juice is anything existing in spacetime. Gravity is the distortion of the shape of the lemon.
Photons may not have any rest mass, but they move in a straight line. When there's gravity, straight lines are not straight anymore, and therefore photons curve around massive bodies.
If photon is mass-less and gravity can interact only with matter, then how gravity can alter the trajectory of light?
The second part of your "if" clause is incorrect. It's mass-energy, not just mass, that gravitates.