Direct proof that a group is Hopfian Consider the group $G=\langle x_1,x_2,x_3|x_1^2,x_2^2,x_3^2\rangle$. Using a slightly modified version of S. Ivanov's proof here that free groups are residually finite, I can show that this group is residually finite. Since it is clearly finitely generated, this implies it is Hopfian.
Proof: Let $x_{i_n}\cdots x_{i_1}$ be a reduced word in $G$, so $i_k\ne i_{k+1}$ for any $1\le k\le n$. Define $f_1,f_2,f_3\in S_{n+1}$ as follows. For $1\le k\le n$, let $f_{i_k}(k)=k+1$ and $f_{i_k}(k+1)=k$, which is well-defined as $i_{k+1}\ne i_k$, and let each $f_i$ fix every other element of $\{1,\ldots,n+1\}$. Then each $f_i^2=\mathrm{id}$, so $f:G\to S_{n+1}$ defined by $f(x_i)=f_i$ is a homomorphism, and $f(x_{i_n}\cdots x_{i_1})(1)=f_{i_n}\circ\cdots\circ f_{i_1}(1)=n+1$ hence is nontrivial. Thus $G$ is residually finite.
However, I find this proof rather unsatisfying, in part because in the context where $G$ arises I don't see a natural interpretation of residual finitude. Is there a more direct way to prove that $G$ is Hopfian, perhaps analogous to direct proofs that finitely generated free groups are Hopfian (see for example prop. 3.5 of Combinatorial Group Theory by Lyndon & Schupp)?
 A: Here are the details for my comment with a "direct proof" (by reduction to the free group case) of Hopfian property for groups $G=H_1*...*H_k$, where each $H_i$ is a finite group, say, $Z_2$ in OP's question. (Note that I did not claim that such reduction holds in general, Yves constructed a nice counter-example to such a claim, see his comment above.) 
Let $f: G\to G$ be an epimorphism. Every finite order element of $G$ is conjugate to one of the subgroups $H_i$. I claim that kernel of $f$ is torsion-free: Otherwise consider the projection
$$
\bar{f}: \bar{G}=H_1\times ...\times H_k \to \bar{G}. 
$$ 
Then $\bar{f}$ is surjective and not injective homomorphism of finite groups, which is impossible. 
Let $F\subset G$ be a free subgroup of finite index, let $F'=f^{-1}(F)$. By the above observation, $F'$ is also torsion-free, hence, free. Clearly, $i=|G:F|=|G:F'|$. Therefore,
$$
\chi(F)=\chi(F')= i\chi(G).
$$
Here I am using the virtual Euler characteristic $\chi(K)$ of groups $K$, which is also the Euler characteristic of the suitable hyperbolic orbifold $O$ so that $K=\pi_1(O)$. 
Since both $F, F'$ are free groups, $\chi(F)=1-r$, $\chi(F')=1-r'$, where $r$, $r'$ are ranks of $F$ and $F'$ respectively. Thus, $f$ restricts to an epimorphism $f': F'\cong F\to F$. This epimorphism has to be injective since $F$ is Hopfian. Clearly, $Ker(f)=Ker(f')$, so injectivity of $f'$ implies injectivity of $f$. qed
I'd say that this argument is not any better than the argument which uses residual finiteness of $G$. There is also an alternative argument proving Hopfian property for $G$ which uses group actions on simplicial trees directly, without using Hopfian property for ree groups. 
