Glass prism has a higher refractive index than air, which means light travels slower in there. When white light enters the prism, it changes direction because of the slower speed. Red and blue have difference wavelengths and frequencies so they change directions by different amounts. Due to this, the angles of refraction are different and they split up.
I wrote that the glass prism has a higher refractive index which means it is denser. When the white light enters, it refracts towards the normal. Red light produces less bending, whereas blue light produces more bending. Also that they have different wavelengths. When they leave, they bend away from the normal, again different bending. Difference in the angle of refraction present