Let $A,B\in \Bbb C^{n\times n}$ and $G:\Bbb C^{n\times n} \to \Bbb C^{n\times n}$ defined by $$G(X)=XA-BX$$ Please show that $G(X)=Y$ has a solution $X$ for any $Y$ $\iff$ $A$ and $B$ have no common eigenvalues.
By Show that $B$ must equal $0$ if $A$ and $C$ have no common Eigenvalues, I know how to prove $\Leftarrow$ part. For $\Rightarrow$, since $G$ is linear and by the assumption, $G$ is surjective, $G$ is invertible. Hence, $A$ and $B$ are not similar and they have different characteristic polynomials. But this does imply they have no common eigenvalues. Appreciate any suggestion.
Here is a proof. As you note, $G$ is surjective linear map over $\Bbb C^{n \times n}$. Because $\Bbb C^{n \times n}$ is finite-dimensional, $G$ is also injective, which is to say that $G(X) = 0 \implies X = 0$.
On the other hand, suppose for the purpose of contradiction that $A,B$ have a common eigenvalue $\lambda$. Let $x \in \Bbb C^n \setminus \{0\}$ be such that $A^Tx = \lambda x$, and let $y \in \Bbb C^n \setminus \{0\}$ be such that $By = \lambda y$. Let $X = yx^T$. Verify that $X \neq 0$, but $G(X) = 0$, contradicting the injectivity of $G$.