White light is composed of all colors of light in the visible spectrum. A prism diffracts all the colors in white light at different angles, separating them.
Each and every color in the visible spectrum has a different wavelength, so each color has a different index of refraction. This means that each color bends a different amount when passing into a new medium, such as a prism. Thus the colors of the light are separated. This is also why colors are always in the same order in a rainbow. It starts from the color with the longest wavelength, red, which has the lowest index of refraction, and it ends with the color with the shortest wavelength, violet, which has the largest index of refraction.