Now as $x$ is of order $4$ and it generates $H=\langle x\rangle$ a cyclic subgroup of $G$ of order $4$, hence index of $H$ in $G$ is $2$. So $H=\langle x\rangle$ is normal in $G$.
Now $gH=Hg $, for all $g$ in $G$.
=> $g(x^2)=(x^2)g\:$ (since $x^2$ is an element of $H$), for all $g$ in $G$.
Hence $x^2 \in Z(G)$.
This was my approach. (I think that I am wrong in here, $g(x^2)=(x^2)g$) Please, correct me wherever necessary. And if you could provide a better solution, please do.
$gH=Hg$ does not imply that $gh=hg$ for all $h\in H$. These are different things.
Here is a possible solution. Let $g\in G$. Then $gx^2g^{-1}=(gxg^{-1})^2$. Since $\langle x\rangle\trianglelefteq G$ we know that $gxg^{-1}\in\langle x\rangle$. Now what $gxg^{-1}$ might be? Of course it can't be the identity $e$ because the identity is conjugate only to itself. Also it can't be $x^2$ because then we would get $e=(x^2)^2=(gxg^{-1})^2=gx^2g^{-1}$ which is again a contradiction. Hence $gxg^{-1}$ is either $x$ or $x^3$ and hence $gx^2g^{-1}=(gxg^{-1})^2=x^2$.