The following exercise, with a slightly more interesting choice of $\varphi$, is probably a standard exercise in, say, an introductory course in commutative algebra.
Let $k$ be a field. Show that the kernel of the homomorhpsim $$\varphi:k[X,Y]\to k[T],X\mapsto T, Y\mapsto T$$ is exactly the ideal generated by $X-Y$.
A very straightforward solution is to use the division algorithm in the ring $(k[Y])[X]$ of polynomials in $X$ with coefficients in $k[Y]$. I wonder, however, whether this (longer and much more complicated) approach can be made rigorous: for the nontrivial inclusion, consider a polynomial $p(X,Y)$ which is in the kernel. If we write
$$p(X,Y)=\sum_{i,j\leq n}a_{ij}X^iY^j$$
then this conditions means that
$$0=P(T,T)=\sum_{i,j}a_{ij}T^{i+j}=\sum_{r}T^r\sum_{i+j=r}a_{ij}$$
i.e.,
$$A_r:=\sum_{i+j=r}a_{ij}=0\qquad\text{for all }r.$$
Now, we want to show that $p(X,Y)$ is divisible by $X-Y$, or equivalently the rational function $p(X,Y)/(X-Y)$ is a polynomial. But
$$ \begin{equation} \frac1{X-Y} =\frac1X \frac1{1-Y/X} =\sum_{k\geq0} Y^k X^{-1-k}\qquad\qquad(*) \end{equation}$$
so
$$\frac{p(X,Y)}{X-Y} =\sum_{i,j,k}a_{ij}Y^{j+k}X^{i-1-k} =\sum_{r,s}X^rY^s\sum_{\substack{j+k=s\\i-1-k=r\\k\geq0}}a_{ij} =:\sum_{r,s}B_{rs}X^rY^s$$
and if we want this to be a polynomial we need that $B_{rs}=0$ if either $r<0$ or $s$ is large enough. In such cases it is not difficult to show that $B_{rs}=A_{rs}=0$, as wanted.
Since everything seems to work, I guess the argument is fine as long as we know in which ring the equality $(*)$ holds. At first I though it was enough to consider the quotient field of the ring of formal power series in two variables $k[X,Y]$, but in $(*)$ there are coefficients in $X^{-k}$ with $k$ arbitrarily large.
We can justify $(*)$ by working in the ring $k(X)[[Y/X]]$, the ring of formal power series in one variable (which we think of as representing $Y/X$) with coefficients in $k(X)$. We can then make sense of your equation $$\frac{p(X,Y)}{X-Y}=\sum_{r,s}B_{rs}X^rY^s$$ in this ring by interpreting $X^rY^s$ as $X^{r+s}(Y/X)^s$ and observing that we only need terms with $s\geq 0$ and that for fixed $s$ there are only finitely many $r$ with $B_{rs}\neq 0$. To justify reaching conclusions about $k[X,Y]$, we then just need to observe that there is an injective homomorphism $k[X,Y]\to k(X)[[Y/X]]$ mapping $X$ to $X$ and $Y$ to $X\cdot Y/X$.