As mentioned in the comments to the question, it’s the first part of Exercise 2.11 in Atiyah-MacDonald, and I refer to the comments for an answer.
The second part of Exercise 2.11 (which is perhaps more interesting) has been the subject of this MO question.
I especially like Balazs Strenner’s answer.
EDIT. Here is Exercise 2.11 of Atiyah-MacDonald. Let $A$ be a nonzero commutative ring and $\phi:A^m\to A^n$ an $A$-linear map. Then
(a) $m\ge n$ if $\phi$ is surjective,
(b) $m\le n$ if $\phi$ is injective,
As pointed out in the comments to the question, there is an obvious proof of (a) [tensor with $A/\mathfrak m$, $\mathfrak m$ maximal]. My favorite proof of (b) is Strenner's one mentioned above. A natural question is: Can one use Strenner's argument to prove (a) and (b) at one go? I'll try to do that below.
Lemma. Let $B$ be a commutative ring, $A$ a subring, $b$ a nonzero element of $B$ which is integral over $A$ and which is not a zero divisor. Then there is a nonzero $a$ in $A$ and a monic $f$ in $A[X]$ such that $a=bf(b)$.
Proof. Let $g\in A[X]$ be a least degree monic polynomial annihilating $b$. Such exists because $b$ is integral over $A$. The constant term $a$ of $g$ is nonzero because $b$ is nonzero and not a zero divisor. QED
Assume (a) [resp. (b)] is false. Then there is an $n$ and a surjective [resp. injective] endomorphism $b$ of $A^n$ satisfying $b(e_n)=0$ [resp. $b(A^n)\subseteq A^{n-1}$], where $e_n$ is the last vector of the canonical basis and $A^{n-1}$ is the span of all the other vectors of this basis. Then $b$ is integral over $A$ by Cayley-Hamilton, and we get a contradiction by using the lemma (with $B:=A[b]$) and applying $a=bf(b)$ to $e_n$.
Yes, you are correct, it is a polynomial ring on infinitely many generators. Given any set $T=\{t_1,t_2,\ldots\}$, we can form the free $A$-algebra generated by $T$, denoted by $A[t_1,t_2,\ldots]$ or just $A[T]$, which is the polynomial ring with coefficients in $A$ and with the elements of $T$ acting as indeterminates. This construction does not depend on $T$ being finite or infinite. In fact we could take $T$ to be uncountable. An important thing to keep in mind is that while there could be infinitely many elements of $T$, any single element $f(t_i)\in A[T]$, i.e. a polynomial in the symbols $t_i$ with coefficients in $A$, will only use finitely many of the $t_i$.
When $B$ is any $A$-algebra, $B$ is a quotient of $A[\{t_b\}_{b\in B}]$ by sending, for example, $a_1t_{b}+a_2t_{3b}^2$ to $a_1b+a_2(3b)^2=a_1b+9a_2b^2\in B$.
For example, the ring $\mathbb{C}$ is a $\mathbb{Q}$-algebra. We map $\mathbb{Q}[\{t_{\alpha}\}_{\alpha\in\mathbb{C}}]$ to $\mathbb{C}$ by sending each $\mathbb{Q}$-polynomial $f(t_{\alpha},t_{\beta},\ldots)$ to its evaluation when we replace $t_\alpha$ with $\alpha\in\mathbb{C}$, $t_\beta$ with $\beta\in\mathbb{C}$, etc., so that $\mathbb{C}$ is isomorphic to the quotient of $\mathbb{Q}[\{t_{\alpha}\}_{\alpha\in\mathbb{C}}]$ by the kernel of the evaluation map.
Best Answer
Unfortunately, the kernel need not be free. Consider the case $m=n=1$: the homomorphism $\phi:A\to A$ is then multiplication by some $a\in A$, and if $a$ is a zerodivisor, $\ker\phi$ cannot be free because it is annihilated by $a$.
Edit: If $A$ is an integral domain (has no zerodivisors) but has a nonfree stably free module $M$, (see Keith Conrad's expository writeup "A nonfree stably free module" for a minimal example), then we can write $A^m\cong A^n\oplus M$, and the projection $A^m\to A^n$ has kernel $M$, which is not free.