Suppose first that $G$ is Abelian. By definition, $Z(G) = \{ x \in G \mid \forall \, g \in G : x g x^{-1} = g \}$. Since $G$ is a group, the condition for belonging to $Z(G)$ thus obtains the form
\begin{equation}
\begin{split}
x \in Z(G) \quad & \iff \quad \forall \, g \in G : x g x^{-1} = g \\
& \iff \quad \forall \, g \in G : x g = g x \\
\end{split}
\end{equation}
Since $G$ is Abelian, the predicate expression "$\forall \, g \in G : x g = g x$" is satisfied by every $x \in G$, whence $Z(G) = G$.
The implication in the other direction is established in
R755: Group centre is Abelian group. $\square$