This phenomena is known as Dispersion of Light. It occurs because light is made up of seven different colors or wavelengths and thus behave differently upon hitting the prism. It is such that the refractive index of each wavelength varies which splits the single white light, causing dispersion.