[proofplan]
We prove maximality by testing an arbitrary abelian Lie subalgebra $\mathfrak a\le\mathfrak g$ containing $\mathfrak t$. Integrate $\mathfrak a$ to the connected Lie subgroup generated by its exponential image, take its closure in $G$, and show that this closure is a compact connected abelian Lie subgroup containing $T$. Such a subgroup is a torus, so maximality of $T$ forces the closure to equal $T$. Since each $X\in\mathfrak a$ has its one-parameter subgroup inside this closure, $\mathfrak a$ lies in $\mathfrak t$, and the reverse inclusion was assumed.
[/proofplan]
[step:Start with an abelian Lie subalgebra containing $\mathfrak t$]
Let $\mathfrak a\le\mathfrak g$ be an abelian Lie subalgebra such that $\mathfrak t\subset \mathfrak a$. We must prove $\mathfrak a=\mathfrak t$.
First, $\mathfrak t$ is abelian because $T$ is a torus, hence a compact connected abelian Lie group. Thus the conclusion is exactly the containment-maximality of $\mathfrak t$ among abelian Lie subalgebras of $\mathfrak g$.
[/step]
[step:Integrate $\mathfrak a$ and close the resulting subgroup]
Let
\begin{align*}
\exp_G:\mathfrak g\to G
\end{align*}
denote the Lie exponential map of $G$. Let $H\le G$ be the connected immersed Lie subgroup of $G$ with [Lie algebra](/page/Lie%20Algebra) $\mathfrak a$. Equivalently, $H$ is the subgroup generated by the one-parameter subgroups
\begin{align*}
\gamma_X:\mathbb R\to G,\qquad s\mapsto \exp_G(sX),
\end{align*}
as $X$ ranges over $\mathfrak a$.
Since $\mathfrak a$ is abelian, the one-parameter subgroups $\gamma_X$ and $\gamma_Y$ commute for all $X,Y\in\mathfrak a$. Hence $H$ is abelian. Define
\begin{align*}
A:=\overline{H}\subset G,
\end{align*}
where the closure is taken in the topology of $G$.
Because $G$ is compact and $A$ is closed in $G$, the subgroup $A$ is compact. By the closed subgroup theorem, $A$ is an embedded Lie subgroup of $G$. Since $H$ is connected, its closure $A$ is connected. Since multiplication and inversion in $G$ are continuous and $H$ is abelian, the identity $xy=yx$ passes to limits, so $A$ is abelian.
[guided]
The purpose of passing from $\mathfrak a$ to a subgroup is to compare $\mathfrak a$ with the maximal torus $T$, which is a subgroup of $G$. The Lie correspondence gives a connected immersed Lie subgroup $H\le G$ whose Lie algebra is $\mathfrak a$. Concretely, $H$ is generated by the one-parameter subgroups
\begin{align*}
\gamma_X:\mathbb R\to G,\qquad s\mapsto \exp_G(sX),
\end{align*}
for $X\in\mathfrak a$.
We now check that $H$ is abelian. If $X,Y\in\mathfrak a$, then $[X,Y]=0$ because $\mathfrak a$ is abelian. The standard commutation property for one-parameter subgroups says that vanishing Lie bracket implies
\begin{align*}
\exp_G(sX)\exp_G(rY)=\exp_G(rY)\exp_G(sX)
\end{align*}
for all $r,s\in\mathbb R$.
Thus the generators of $H$ commute with each other, and therefore $H$ is abelian.
Now define
\begin{align*}
A:=\overline{H}\subset G.
\end{align*}
This closure is taken in the manifold topology of $G$. Since $G$ is compact and $A$ is closed in $G$, $A$ is compact. Since $A$ is a closed subgroup of the Lie group $G$, the closed subgroup theorem makes $A$ an embedded Lie subgroup of $G$. Since $H$ is connected, its closure $A$ is connected. Finally, abelianness also survives closure: if $a,b\in A$, choose nets or sequences, in a local metrizable neighbourhood and then globally by compactness, $h_i\to a$ and $k_i\to b$ with $h_i,k_i\in H$. Since $H$ is abelian,
\begin{align*}
h_i k_i=k_i h_i.
\end{align*}
Continuity of multiplication in $G$ gives
\begin{align*}
ab=ba.
\end{align*}
Hence $A$ is a compact connected abelian Lie subgroup of $G$.
[/guided]
[/step]
[step:Show that the closed subgroup contains the maximal torus $T$]
Since $\mathfrak t\subset\mathfrak a$, for every $X\in\mathfrak t$ and every $s\in\mathbb R$ we have
\begin{align*}
\exp_G(sX)\in H\subset A.
\end{align*}
The exponential map of the torus $T$ is the restriction
\begin{align*}
\exp_T:\mathfrak t\to T,
\end{align*}
and, for a compact connected abelian Lie group, this exponential map is surjective. Therefore $T=\exp_T(\mathfrak t)\subset A$.
[/step]
[step:Use maximality of $T$ to force $A=T$]
The subgroup $A$ is compact, connected, and abelian. Hence $A$ is a torus. Since $T\subset A$ and $T$ is a maximal torus of $G$, there is no torus in $G$ properly containing $T$. Therefore
\begin{align*}
A=T.
\end{align*}
[/step]
[step:Recover the Lie algebra inclusion from one-parameter subgroups]
Let $X\in\mathfrak a$. By the construction of $H$, the one-parameter subgroup
\begin{align*}
\gamma_X:\mathbb R\to G,\qquad s\mapsto \exp_G(sX)
\end{align*}
has image contained in $H$, hence in $A$. Since $A=T$, this gives
\begin{align*}
\gamma_X(\mathbb R)\subset T.
\end{align*}
The tangent vector of $\gamma_X$ at $0$ is $X$, and because $\gamma_X$ is a smooth curve in $T$ through the identity element, this tangent vector lies in the Lie algebra of $T$. Therefore $X\in\mathfrak t$.
Thus $\mathfrak a\subset\mathfrak t$. Since $\mathfrak t\subset\mathfrak a$ by assumption, we conclude
\begin{align*}
\mathfrak a=\mathfrak t.
\end{align*}
This proves that $\mathfrak t$ is a maximal abelian Lie subalgebra of $\mathfrak g$.
[/step]