You get an equilibrium, depending on the pH of the solution.
If you bubble chlorine gas into water, you get gaseous chlorine in solution in equilibrium with the hypochlorous acid and hydrochloric acid in solution. This is at pH of about 2. As you raise the pH, the amount of gaseous chlorine diminishes and the amount of hydrochloric acid and hypochlorous acid increases. Raise it further(usually with NaOH) and you get an equilibrium between hydochloric acid and hypochlorous acid with sodium chloride and sodium hypochlorite (this is usually at pH ~11).
Choose the pH to get the form you need (Cl2, HOCl, or NaOCl).
Hope this helps.