I know the sunlight is white colour and appears yellow because of dispersion through atmosphere. I want to know why this yellow light when pass through prism divided into 7 colours.
The perceived color of sunlight depends on the angle at which you are viewing it, and it's decided by the time in a day. At noon it looks white, but when it's closer to sunrise or sunset it looks more yellow.
However, just because it looks more yellowish to you does not mean it's a purely yellow light, it's never monochromatic. In the yellow sunlight, the intensity of light of other colors is relatively lower, but the yellow sunlight still contains light with various wavelengths, and that's why we would observe dispersion when it passes through a prism.
Moreover, it's not accurate to say that it 'divided into 7 colors'. There are actually a infinite number of colors because the spectrum is continuous.
It is because the sum of all possible light colors is perceived by your eyes as white, so a beam of white light has all those different colors mixed together in it. The prism is a convenient way of separating out the different colors so we can see them individually.
By the way, once you have separated the colors in this way, you can recombine them with a second prism and reconstruct a beam of white light from all the different colors!