When white light strikes a prism it splits up into all the colors of the rainbow. Why is this?

The reason is that there is no single index of refraction - the index of refraction is different for different wavelengths. Generally, the index of refraction decreases as the wavelength increases. Thus the violet (400 nm) end of the spectrum is refracted more than the red (700 nm) end, with all the other colors in between.

This phenomenon, that the index of refraction depends on wavelength, is known as dispersion.