The white light is a mixture of a large number of wavelengths of lights. The wavelengths all travel at different speeds in the medium. But in the prism they Travel with different speeds, hence when they pass the prism the length of the path travelled in the same time is different which is when they emerge out. So the colours are from different positions which results in a separation of colours. That is called dispersion of light.