[step:Prove injectivity via a rectangular subdivision of a null-homotopy]Let $w \in \pi_1(A, x_0) * \pi_1(B, x_0)$ be a word whose image in $\pi_1(X, x_0)$ is trivial; write $w = [\sigma_1][\sigma_2] \cdots [\sigma_m]$, where each $\sigma_k$ is a loop at $x_0$ contained in $A$ or in $B$. Concatenating gives a loop $\sigma = \sigma_1 \cdot \sigma_2 \cdots \sigma_m: [0,1] \to X$ homotopic to the constant loop at $x_0$, via some null-homotopy
\begin{align*}
H: [0,1] \times [0,1] &\to X, & H(s, 0) &= \sigma(s),\quad H(s, 1) = x_0,\quad H(0, t) = H(1, t) = x_0.
\end{align*}
The preimages $H^{-1}(A)$ and $H^{-1}(B)$ are open and cover $[0,1]^2$. By the Lebesgue Number Lemma (hypotheses verified as in Step 2: $[0,1]^2$ is compact, the cover is open), there is $\delta > 0$ such that every subset of diameter $< \delta$ lies in one preimage. Subdivide $[0,1]^2$ into an $N \times N$ grid of closed rectangles $R_{ij} = [s_{i-1}, s_i] \times [t_{j-1}, t_j]$ with mesh $< \delta$. Refine the partition of $[0,1] \times \{0\}$ so that it includes the division points of $\sigma$ into the factors $\sigma_1, \ldots, \sigma_m$. Each $R_{ij}$ then satisfies $H(R_{ij}) \subseteq A$ or $H(R_{ij}) \subseteq B$.
Label each vertex $p = (s_i, t_j)$ of the grid by its image $H(p) \in X$. For each internal vertex not lying on the top or bottom edge, the four adjacent rectangles need not all lie in $A$ or all in $B$; however, if all four sit in $A$ and all four sit in $B$, then $H(p) \in A \cap B$. More precisely:
[claim:Every grid vertex $p$ with $H(p) \notin A \cap B$ has a consistent colour at its neighbouring rectangles]
If $H(p) \in A$ but $H(p) \notin B$, then every rectangle $R_{ij}$ containing $p$ satisfies $H(R_{ij}) \subseteq A$. Symmetrically if $H(p) \in B \setminus A$.
[proof]
Suppose $H(p) \in A \setminus B$ and some adjacent rectangle $R$ has $H(R) \subseteq B$. Then $H(p) \in H(R) \subseteq B$, contradicting $H(p) \notin B$.
[/proof]
[/claim]
Choose, for each grid vertex $p$, a path $\alpha_p$ in $X$ from $x_0$ to $H(p)$, with the following constraints:
- If $H(p) \in A \cap B$, choose $\alpha_p$ to lie in $A \cap B$ (possible by path-connectedness of $A \cap B$).
- If $H(p) \in A \setminus B$, choose $\alpha_p$ to lie in $A$ (possible by path-connectedness of $A$).
- If $H(p) \in B \setminus A$, choose $\alpha_p$ to lie in $B$.
- For vertices on the boundary of $[0,1]^2$ where $H(p) = x_0$, take $\alpha_p$ constant at $x_0$.
For each rectangle $R_{ij}$, let $\partial R_{ij}$ denote its boundary loop (traversed counterclockwise starting from the lower-left corner). The map $H|_{\partial R_{ij}}$ is a loop in either $A$ or $B$ at the image of the lower-left corner. Conjugating by the chosen path $\alpha_{p_{ij}}$ (where $p_{ij}$ is the lower-left corner) yields a loop $\ell_{ij}$ at $x_0$ contained in $A$ or in $B$, whose class in $\pi_1(A, x_0)$ or $\pi_1(B, x_0)$ we denote $[\ell_{ij}]$.
Since $R_{ij}$ is simply connected (it is a rectangle, homeomorphic to a disk) and $H$ maps it into $A$ or into $B$, the boundary loop $H|_{\partial R_{ij}}$ is null-homotopic in that subspace. Hence
\begin{align*}
[\ell_{ij}] = 1 \quad \text{in } \pi_1(A, x_0) \text{ or } \pi_1(B, x_0), \text{ whichever contains } H(R_{ij}).
\end{align*}
The boundary of $[0,1]^2$ equals the union of the $\partial R_{ij}$ with all internal edges traversed twice, once in each direction. Translating to words in $\pi_1(A, x_0) * \pi_1(B, x_0)$, and tracking the conjugations by the $\alpha_p$, we obtain an equality of words
\begin{align*}
w = \prod_{i,j} (\text{conjugate of } [\ell_{ij}])
\end{align*}
modulo the following relations: whenever an internal edge lies in $A \cap B$, the loop it contributes can be expressed in $\pi_1(A)$ or equivalently in $\pi_1(B)$, giving a relation of the form $k_A(i_{A*}[h]) = k_B(i_{B*}[h])$ for some $[h] \in \pi_1(A \cap B, x_0)$. This is precisely the amalgamation relation in $\pi_1(A) *_{\pi_1(A \cap B)} \pi_1(B)$.
Every vertex with $H(p) \in A \cap B$ has the flexibility to reinterpret the edges through it as lying in $A$ or in $B$: the amalgamation relation permits this reinterpretation in the amalgamated product. Every edge contained in $A \cap B$ similarly permits both interpretations. Every $[\ell_{ij}]$ is trivial in $\pi_1(A)$ or $\pi_1(B)$, contributing a trivial factor. Assembling the boundary equation and applying these permitted moves, the word $w$ reduces to $1$ in $\pi_1(A, x_0) *_{\pi_1(A \cap B, x_0)} \pi_1(B, x_0)$. Hence $\ker \Phi$ is trivial, i.e., $\Phi$ is injective.
<!-- illustration-needed: the null-homotopy square $[0,1]^2$ subdivided into a grid of rectangles, each rectangle shaded with colour indicating whether $H$ maps it into $A$ or into $B$, with vertices on the bottom edge labelled by the decomposition points of $\sigma = \sigma_1 \cdots \sigma_m$, and a path $\alpha_p$ from $x_0$ sketched to an internal vertex $p$ -->[/step]