Let’s use induction on dimension. The claim is vacuously true for $n=1$.
If $n\geq 2$, then partition the upper-triangular matrix $T$ as follows:
$$T=\left[\begin{array}{c}S&x\\0&c\end{array}\right]$$ where $S\in\mathbb C^{(n-1)\times(n-1)}$, $x\in\mathbb C^{(n-1)\times 1}$, $0\in\mathbb C^{1\times (n-1)}$, and $c\in\mathbb C$. Then, we have that $$T^H=\left[\begin{array}{c}S^H&0\\x^H&\overline c\end{array}\right]$$ where the bar denotes complex conjugate. It is easy to compute that
\begin{align*}TT^H=&\,\left[\begin{array}{c}SS^H+xx^H&\overline cx\\cx^H&|c|^2\end{array}\right]\\T^HT=&\,\left[\begin{array}{c}S^HS&S^Hx\\x^HS&x^Hx+|c|^2\end{array}\right]\end{align*}
If $T T^H=T^HT$, then one must have, in particular (look at the lower right corners), that $x^Hx+|c|^2=|c|^2$, which implies that $x=0$.
It follows (look at the upper left corners) that $SS^H=S^HS$, which, by the induction hypothesis and the fact that $S$ is upper-triangular, implies that $S$ is a diagonal matrix. Since we also have $x=0$, $T$ is a diagonal matrix, too, so that the induction goes through.