we know that photons have their rest mass zero then why does they bend due to gravity of earth?
Space-time around a massive object (such as a massive star or a black hole) is curved. In general relativity, light follows the curvature of space-time, hence when light passes around a massive object, it is bent. The Earth is not massive enough to produce any noticeable bending of light. It's much more noticeable when huge mass is involved: massive stars, black holes, galaxies, or galactic clusters.