For every elements $a\in G$, consider
$$\phi_a:G\rightarrow G$$
sending an element $b$ to its conjugate $a^{-1}ba$.
You can easily check that all $\phi_a$ are automorphisms of $G$, called inner automorphisms. By assumption, $\phi_a=id$, which means
$$\phi_a(b)=b$$
for every $a,b\in G$, so that $ba=ab$.
Alternatively, use
$$\frac{G}{Z(G)}\cong Inn(G)$$
where $Z(G)$ is the center of $G$ and $Inn(G)$ the group of inner automorphisms, which is trivial in your hypothesis.
As for $g^2=e$, you can use abelianity we have just proved. Since $(ab)^{-1}=b^{-1}a^{-1}=a^{-1}b^{-1}$, the inversion $g\rightarrow g^{-1}$ is an automorphism, which by assumption is trivial. Multiplying $g=g^{-1}$ by $g$ gives $g^2=e$