Diffraction grating consists of a large number of fine slits.
Light gets split into different colors due to these slits of the diffraction grating.
Thus, diffraction grating produces a pattern of the coloured bands as each light wave passes through the slit at different speeds and different angles.