Say I have some element $g\in G$ such that $g$ is of infinite order. I want to show that $|g|=|\langle g \rangle|$.
I know that if $g$ is of infinite order, then there does not exist any $n$ such that $g^n=1$.
To set up a contradiction, let's suppose there exists $s,t$ such that $g^s=g^t$, if I multiply both sides by $g^{-t}$ I get that $g^{s-t}=g^{t-t}=g^0=1$. This contradicts our original statement of $g$ being of infinite order.
Is this enough to show that $|g|=|\langle g \rangle|$? I have shown that there does not exist any power of $g$ such that it will bring you back to $1$, so can I therefore say that since $\langle g \rangle$ is made of powers of $g$ that it, too, has infinite order?
Edit: $|g|$ is defined as "$n>0$ such that $n$ is the smallest positive integer that gives $g^n=e$ where $e$ is the identity element.
Yes. Since $g^s\neq g^t$ for all $s\neq t$, $\langle g\rangle=\{g^k\mid k\in\mathbb{Z}\}$ contains an infinite number of elements. Hence, $|g|=\infty=|\langle g\rangle|$.