[guided]The finite case is controlled by the first time a positive power of the generator returns to the identity. Since $G$ has $n$ elements, the list $1_G,g,g^2,\dots,g^n$ contains $n+1$ elements of an $n$-element set. Therefore two entries in the list must be equal: there exist integers $i,j$ with $0 \le i < j \le n$ and $g^i=g^j$. Multiplying by $g^{-i}$ gives $g^{j-i}=1_G$. Thus at least one positive exponent sends $g$ to the identity.
Let $m$ be the least positive integer such that $g^m=1_G$. We now show that $m$ counts the elements of the cyclic group generated by $g$. First, every power of $g$ reduces to one of the powers with exponent between $0$ and $m-1$. If $q \in \mathbb{Z}$, Euclidean division gives integers $a \in \mathbb{Z}$ and $r \in \{0,1,\dots,m-1\}$ such that $q=am+r$. Then $g^q = g^{am+r} = (g^m)^a g^r = 1_G^a g^r = g^r$.
So every element of $G=\langle g\rangle$ lies in $\{1_G,g,g^2,\dots,g^{m-1}\}$.
Second, these $m$ elements are distinct. Suppose $0 \le r < s \le m-1$ and $g^r=g^s$. Multiplying by $g^{-r}$ gives $g^{s-r}=1_G$. But $s-r$ is a positive integer strictly smaller than $m$, contradicting the minimal choice of $m$. Therefore the displayed elements are distinct.
We have shown that $G$ consists of exactly $m$ elements. Since the hypothesis says $|G|=n$, it follows that $m=n$. Therefore $g^n=1_G$, and no positive exponent smaller than $n$ sends $g$ to $1_G$.
Now we compute the kernel of $\varphi$. By definition, $\ker \varphi = \{k \in \mathbb{Z} : \varphi(k)=1_G\} = \{k \in \mathbb{Z} : g^k=1_G\}$.
If $k \in n\mathbb{Z}$, then $k=an$ for some $a \in \mathbb{Z}$, and $g^k = g^{an} = (g^n)^a = 1_G$.
Thus $n\mathbb{Z}\subseteq \ker\varphi$.
Conversely, suppose $k \in \ker\varphi$. Write $k=an+r$ with $a \in \mathbb{Z}$ and $r \in \{0,1,\dots,n-1\}$. Since $g^k=1_G$ and $g^n=1_G$, $1_G = g^k = g^{an+r} = (g^n)^a g^r = g^r$.
The integer $r$ is between $0$ and $n-1$. Since $n$ is the least positive exponent with $g^n=1_G$, the equality $g^r=1_G$ forces $r=0$. Hence $k=an \in n\mathbb{Z}$. Therefore $\ker\varphi=n\mathbb{Z}$.[/guided]