Yes. Suppose that $X$ has smaller dimension at $x$ than $Y$. Embed $Y\subseteq\mathbb{P}^n$ using a square of a very ample line bundle. For a general linear subspace $L$ in $\mathbb{P}^n$ through $x$ of the right codimension, $X\cap L$ will be finite and $Y\cap L$ will be a curve. Normalizing that curve and completing at some preimage of $x$ gives you a map $Spec(k[[t]])\to Y$, mapping the closed point to $x$, whose image is not contained in $X$. But then some $k[[t]]/(t^n)$ does not map to $X$.
The above shows that the answer is yes if $Y$ is reduced. See answer_bot's comment below for a counterexample if $Y$ is non-reduced.