Chlorine is used in swimming pools as a disinfectant to kill bacteria, viruses, and other microorganisms that could make swimmers sick, effectively keeping pool water clean and safe for use by forming a weak acid called hypochlorous acid when added to the water; this process prevents the spread of germs like E. coli and salmonella.