I borrow this proof from [Birkenhake-Lange, Complex Abelian Varieties, Lemma 1.1.1].
Let $X$ be a projective variety having a group structure. I assume that we are working over $\mathbb{C}$.
Consider the commutator map $\Phi(x,y)=xyx^{-1}y^{-1}$, and let $U$ be a coordinate neighborhood of $1 \in X$. By the continuity of $\Phi$, and since $\Phi(x,1) =1 \in U)$$\Phi(x,1) =1 \in U$, for all $x \in X$ we can find open neighborhoods $U_x$ and $W_x$ such that $\Phi(U_x, W_x) \subset U$.
Since $X$ is compact, finitely many $V_x$ cover $X$. Calling $W$ the intersection of the corresponding subsets $W_x$, we get $\Phi(X, W) \subset U$.
Now $\Phi(1, y)=1$ for all $y \in W$. Since holomorphic functions on a compact variety are constant, it follows $\Phi(X, W)\equiv 1$. SinceBeing $W$ is open and non-empty, this in turn implies $\Phi(X, X) \equiv 1$, which is our claim.
Notice that "projective" is not really necessary, in fact what we actually use in the only necessary assumptionproof is "compact complex". In factIndeed, pushing further this proofargument (by usinga straightforward use of the exponential map) one showscan show that any compact complex connected Lie group is a complex torus.