When an acid or a base is dissolved in water, they get dissociated into ions.
When hydrochloric acid is dissolved in water, it get dissociated into ions such as protons (H+ ions) and Cl- ions as follows:
HCl + H2O → H3O+ + Cl-
As there is an increase in the protons in the aqueous solutions, the solution is acidic in nature.
Similarly, when NaOH is dissolved in water, it get dissociated as,
NaOH + H2O → Na+ + OH- + H2O
As there is an increase in the hydroxyl ions in the solution, the solution is basic in nature.
Basic aqueous solution is called alkali.