a problem on composition of functions
What I like about this problem is that it places no restriction on the carinality $A$; its conclusion binds for some very large sets indeed.
Suppose $f$ is not surjective, and let
$B = f(A) \tag 1$
be the image of $A$ under $f$; since
$f \circ f = f, \tag 2$
it is clear that every element of $B$ is fixed under $f$, for
$b \in B \Longrightarrow \exists c \in A, \; b = f(c) \Longrightarrow f(b) = f(f(c)) = f(c) = b; \tag 3$
furthermore, for $c \in A$,
$f(c) = c \Longrightarrow c \in B; \tag 4$
thus $B$ is precisely the set of fixed points of $f$.
We have assumed $f$ not surjective; then by the above we have
$B \subsetneq A, \tag 5$
which implies
$\exists a \in A \setminus B; \tag 6$
if
$b = f(a) \in B, \tag 7$
then
$f(b) = f(f(a)) = f(a) = b; \tag 8$
we note
$B \ni b \ne a \in A \setminus B, \tag 9$
which contradicts the given hypothesis that $f$ is an injective map. Thus $f$ is in fact surjective.