Hmm, being gassed by CO2 is not exactly like going to sleep, as much as I'm sure they would like you to believe that! (Although it may be the least worst option of slaughter, I'm not sure)
CO2 reacts with the moisture in their eyes, nose, and throat to form carbonic acid, which causes intense burning, irritation, and a distressing feeling of breathlessness (air hunger).
Unconsciousness is not instantaneous, leading to a period of suffering. Chickens can detect CO₂ at very low levels. Before they are fully sedated, birds often panic, attempting strenuous escapes, shrieking, shaking their heads, gasping for air, and jumping.
At concentrations typically used in commercial settings, it takes about one minute for a chicken to lose consciousness. In phased systems where the gas concentration rises gradually, this period can stretch to several minutes, during which the birds may still feel fear and pain.
There are other gases which could be used which would be painless. But my understanding is that they aren't used for human safety reasons, as an escape of these other gasses would be a danger to human life and the workers may not be able to tell before it was too late. Which is fair enough, to be honest!
We keep rescue hens who are at the end of their laying career
https://www.bhwt.org.uk/hen-adoption/