Solution (source code)

= Solution
{c}

Use a <topological graph> consisting of the ray $[0,\infty)$ with <vertices> $v_n=n$ and one oriented <graph loop> $\ell_n$ attached at each $v_n$, for $n=0,1,2,\ldots$. Set the <base point> to $b=v_0$. This is a <connected>, <locally finite graph>; it is deliberately infinite.

Define <continuous maps> $f,g:X\to X$ by
$$
\begin{aligned}
f(t)&=t+1&&\text{on the ray},&
f(\ell_n(s))&=\ell_{n+1}(s),\\
g(t)&=\max(t-1,0)&&\text{on the ray},&
g(\ell_n(s))&=\begin{cases}b,&n=0,\\\ell_{n-1}(s),&n\geq1.\end{cases}
\end{aligned}
$$
Here each <graph loop> is parametrized by $s\in[0,1]$ with its endpoints at the attaching <vertex>. The formulas agree at every <vertex>, and their restrictions to every closed <edge> are <continuous>. The <weak topology of a CW complex> therefore makes $f,g$ <continuous maps>. Directly on the ray and on each <graph loop>,
$$
\boxed{gf=\operatorname{id}_X.}
$$

We check the two <fundamental group> maps at exactly the specified <base point>s. The ray is a <spanning tree>. At $b=v_0$ a <free basis of a group> consists of $a_n$, obtained by going along the ray to $v_n$, following $\ell_n$, and returning. At $f(b)=v_1$, use the corresponding <free basis of a group> $c_n$ with connecting <paths> starting at $v_1$; in particular $c_0$ travels backwards along the first <edge> before following $\ell_0$. The standard <spanning tree> description applies to this infinite <topological graph> as well: every <loop (topology)> and every <homotopy> between <based loops> has <compact> <image>, so lies in a finite <subcomplex>.

The induced <group homomorphisms> are
$$
\boxed{f_*(a_n)=c_{n+1},\qquad
g_*(c_0)=1,\quad g_*(c_n)=a_{n-1}\ (n\geq1).}
$$
Thus $f_*$ misses $c_0$: words in $c_1,c_2,\ldots$ cannot equal $c_0$ by the <normal form for free groups and free product of groups>. Consequently $f_*$ is not <surjective>. Meanwhile $c_0$ is a nontrivial <free group> element killed by $g_*$, so $g_*$ is not <injective>. \b[Neither induced map is a <group isomorphism>], while <functoriality of the fundamental group> correctly gives $g_*f_*=\operatorname{id}$.