Lets suppose there is a huge planet having large amount of gravitational pull, then will the light passing through the planet get attracted towards it.
Light (in general relativity) follows paths in spacetime dictated by the curvature of spacetime. That curvature is a result of gravitational distortion of spacetime by energy (and this includes mass as a form of energy).
So light follows curved paths through curved spacetime.
You should not, however, think of light as feeling a gravitational force in a Newtonian sense. This is not what happens. You need to forget Newtonian ideas like that in general relativity. For example, it's tempting to say that light is attracted to a gravitational source, but this is not really the case and can lead to incorrect thinking (e.g. like imagining light was being accelerated, which it is not).
The technical term for paths that light follows in spacetime is null geodesic (the link is to a Q&A on the Physics SE site). I suspect that's possibly more that the OP wants to knows, but the link is there to investigate if they want to.