For a weak acid $\ce{HA}$ with acid constant $K_\mathrm{a}$:
$$\ce{HA + H2O <=> H3O+ + A-} \tag1$$
$$K_\mathrm{a} = \frac{[\ce{H3O+}][\ce{A-}]}{[\ce{HA}]} \ \Rightarrow \ [\ce{H3O+}] = K_\mathrm{a} \cdot \frac{[\ce{HA}]}{[\ce{A-}]} \tag2$$
Taking $-\log$ of both side of equation $(2)$:
$$-\log [\ce{H3O+}] = -\log K_\mathrm{a} -\log \frac{[\ce{HA}]}{[\ce{A-}]} $$
Or
$$\mathrm{pH} = \mathrm{p}K_\mathrm{a} + \log \frac{[\ce{A-}]}{[\ce{HA}]} \tag3$$
The equation $(3)$ is called Henderson-Hackleback equation (see Poutnik's comment elsewhere). According to the Le Chatelier principle, if you remove $\ce{H3O+}$ from the equilibrium $(1)$ (Note: you can do this by adding appropriate amount of strong base as a titrant, e.g., $\ce{NaOH}$ solution; $\ce{H3O+ + OH- -> 2H2O}$), more of $\ce{HA}$ ionizes to form $\ce{H3O+}$, thus, decreasing $[\ce{HA}]$ as a result. As a consequence, $[\ce{A-}]$ also increases at the same time. Therefore, $\mathrm{pH}$ of the solution increases according to the equation $(3)$.
To answer your question about "why does the peek of the curve has $\ce{HA}$ only and the trough has $\ce{A-}$ only?": Again, if $\ce{HA}$ is in acid medium (increasing amount of $\ce{H3O+}$), according to the Le Chatelier principle, the equilibrium $(1)$ favored the backward reaction so that more $\ce{HA}$ produces. At one point, if $[\ce{H3O+}]$ high enough (say $\mathrm{pH} \lt 4.5$ in your case), there won't be sufficient $[\ce{A-}]$, because all $\ce{A-}$ would be protonated to give only $\ce{HA}$.
During the titration (removing $\ce{H3O+}$), when you reached the endpoint by removing all $\ce{H3O+}$, you have only $\ce{A-}$ remaining in the solution. Yet, resulting $\ce{A-}$ would established following equilibrium:
$$\ce{A- + H2O <=> HA + OH-} \tag4$$
Suppose you add one extra drop of $\ce{NaOH}$ solution. That increase the $[\ce{OH-}]$ in the mixture and again, according to the Le Chatelier principle, the equilibrium $(3)$ favored the backward reaction so that more $\ce{A-}$ produces. Thus, as further addition of the titrant, only $\ce{A-}$ remains in the solution (of course, with $\ce{OH-}$, thus further increasing $\mathrm{pH}$).