Hi,
A light ray is refracted (bent) when it passes from one medium to another at an angle and its speed changes. When light ray enter into glass prism, because different wavelengths (colors) of light travel through a medium at different speeds. The amount of bending is different for different wavelengths. Violet is bent the most and red the least because violet light has a shorter wavelength, and short wavelengths travel more slowly through a medium than longer ones do. Because white light is made up of all visible wavelengths, its colors get separated (dispersed).