Did Newton, or Al-Haytham, discover that white light consists of various rays of coloured light?
So far as we know from their writings, both knew that coloured light could be produced from white light. Both wrote books which discussed, for example rainbows.
Al-Haythem certainly lived earlier (965-1030) than Newton (1642-1727) so Al-Haytham understood and wrote about many principles of optics before Newton was born.
However it seems that Al-Haytham didn't have a complete explanation, consistent with our current understanding of how the colours of a rainbow are produced.
In The Rainbow Bridge Rainbows in Art, Myth, and Science Raymond L. Lee, Jr writes of the considerable achievements of Alhazen (Al-Haytham) but suggests some aspects that he was unable to complete.

The Istanbul Museum of the History of Science and Technology in Islam have a work on optics that states
Known in europe as alhazen, this
eminent mathematician, astronomer and physicist,
who came to the fore with a new optics arrived
at by systematic experiments, developed his own
meteorological−optical explanation for the phenomenon of the rainbow in his treatises on the circular
burning glasses and on the rainbow and the halo.
although with his explanation of the origin of the
rainbow through reflection on a concave spherical
cloud, Ibn al−Haitam did not understand the true
state of affairs, nevertheless, he laid a solid foundation for further experiments which, after about 20
years, led to a revolutionary breakthrough.
It was Kamaladdin Abu l−Hasan Muhammad b.
al−Hasan al−Farisi (d. 718/1318), a versatile natural scientist, who declared the explanation of the
preceding scholars about the origin of the rainbow
through simple reflection of light on drops of water
to be incorrect.
A step that Newton took, which (so far as I know) Al-Haytham did not was
Newton set up a prism near his window, and projected a beautiful spectrum 22 feet onto the far wall. Further, to prove that the prism was not coloring the light, he refracted the light back together.
Newton and the Color Spectrum
[Newton] gave a detailed explanation of his discoveries in public lectures between 1669 and 1671 (published in 1728 as Lectiones Opticae) and in a paper to the Royal Society in 1672. In 1675, he presented another paper which described further experiments on the colour of thin films and plates, and which put forward a corpuscular theory of light which was surprisingly similar to the modern theory of light quanta. Newton’s Opticks, first published in 1704, went through many editions and was the most influential work on experimental science for almost all of the century. Amongst other things, it explained how raindrops refract sunlight to form rainbows. This was the first chromatic explanation of a phenomenon that had fascinated scientific writers, including Aristotle, Alhazen, Vitello and Antonio de Dominis, since the account of Noah’s Ark was first written down.
Newton and the Colour of Light
Conclusion
It was most likely Newton who first demonstrated that white light consisted of various rays of coloured light. He demonstrated that white light could be split apart into coloured light which could then be recombined to re-form white light thus proving that white light consisted of a mixture of coloured light. I've not found any evidence that anyone prior to Newton was reported as having reached this conclusion and provided convincing proof. There is some evidence that Al-Haytham did not.
From the works he published and from the references to him by later scholars and scientists it is evident that Al-Haytham was a fine scholar and scientist. There is no need to attribute to him discoveries that he did not make.
Newton famously said "If I have seen further it is by standing on the shoulders of giants."