Why does dispersion occur?
Splitting white light into its seven constituent colours (wavelength), by passing it through a transparent medium is known as dispersion of light.
The light of different colours present in white light has different wavelengths, and they travel at different speeds in a medium.
You know that the refraction of a light ray in a medium depends on its speed. As each coloured light has a different speed, the constituent coloured lights are refracted at different extents inside the prism. Moreover, the refraction of a light ray is inversely proportional to its wavelength.
Thus, the red coloured light, which has a large wavelength, is deviated less while the violet coloured light, which has a short wavelength, is deviated more.