Let $X_1,X_2$ be topological spaces and $F\in \mathcal{C}(X_2,X_1)$. Let $\Phi:\mathcal{C}_b(X_1,\mathbb{C})\to\mathcal{C}_b(X_2,\mathbb{C}): \Phi(f):=f\circ F$. Then $\Phi$ is a continuous homomorphism between algebras (since $\|\Phi(f)\|_{\infty} \le \|f\|_{\infty}$).
Show: if $\Phi$ is injective, $X_1$ normal and Hausdorff, and $X_2$ compact, then $F$ is surjective.
My attempt:
Suppose that $F$ is not surjective: $\exists x\in X_1: \forall y\in X_2: F(y)\ne x$. Then $\{x\}$ and $\{ F(y)\}$ are disjoint and closed subsets in the Hausdorff space $X_1$, and this for all $y\in X_2$. Since $X_1$ is normal, we can apply Urysohn's lemma:
$$ \exists f_y\in \mathcal{C}(X_1,[0,1]): f_y(F(y))=0\text{ and } f_y(x)=1.$$
To use the injectivity of $\Phi$, I would have to show that $f_y$ is bounded, because then $(f_y\circ F)(y)=\Phi(f_y)(y) =0,\forall y\in X_2. $ This implies $\Phi(f_y) = 0_{\mathcal{C}_b(X_2,\mathbb{C})} = \Phi(0_{\mathcal{C}_b(X_1,\mathbb{C})}),\forall y\in X_2 \Rightarrow f_y = 0,\forall y\in X_2 \Rightarrow f_y(x)=0,\forall y\in X_2$, a contradiction.
Given $X_2$ is compact, we get that $F(X_2)$ is compact in $X_1$ and therefore closed. How can I complete this proof?
Good ideas here, but re-order them and go for the simplest approach first:
Suppose $F[X_2] \neq X_1$; we will derive a contradiction.
So pick $x_1 \in X_1\setminus F[X_2]$, to witness the non-equality. Note that $F[X_2]$ is compact ($X_2$ is compact and $F$ is continuous) and so $F[X_2]$ is closed in $X_1$ (as $X_1$ is Hausdorff).
Then apply your idea and find a Urysohn function $g: X_1 \to [0,1]$ such that $g(x) = 0$ for all $x \in F[X_2]$ and $g(x_1)= 1$ (using that $\{x_1\}$ is also closed, from Hausdorffness, and normality of $X_1$ of course).
Then $\Phi(g)$ is the function that is identically $0$ on $X_2$, call it $\textbf{0}_{X_2}$ say, as
$$\forall x \in X_2: \Phi(g)(x)= g(F(x)) = 0 \text{ because } F(x) \in F[X_2] \text{ and the construction of } g$$
but as $\Phi(\textbf{0}_{X_1}) = \textbf{0}_{X_2}$ as well and $g \neq \textbf{0}_{X_1}$ we have a contradiction with the injectivity of $\Phi$.