The speed of light is slower in various materials than it is in a vacuum or outer space. When the light passes into a material at an angle, the light beam is bent or refracted according to Snell's Law and the index of refraction of the material. But also, the speed of light through a material varies slightly with the wavelength or frequency of the light. Thus, each wavelength is refracted at a slightly different angle when passing through a material at an angle. This spreading out of the beam of light is called dispersion or chromatic dispersion. This can be seen when sunlight passes through a glass prism. Dispersion can cause problems with camera lenses and must be minimized.

i was just wondering why blue light is bent more than red light when light is passed through a prism. Could someone explain this?

It is bent more because the refractive index of a dielectric such as glass is usually higher for shorter wavelengths. The reason that it is higher is tied in with how an EM wave polarises atoms within the medium as it propagates. The details of this are non-trivial, I suggest maybe reading up on the Kramers-Kronig relations and importantly, how they are derived.