Chlorine reacts with pretty much any organic compound (hair, sweat, skin, urine) to produce chloramine. And yes, while this is the thing that irritates your eyes, it's not to say that chlorine is harmless either. There is evidence for respiratory and organ damage from extended exposure to chlorinated pools.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4351252/