Since $X \subset X \cup Y$, the same injection $f$ demonstrating that $X$ is infinite can also be made to demonstrate that $X \cup Y$ is infinite.
For ease of notation, suppose $X$ and $Y$ are disjoint. (We won't count duplicates in the union, so this is a fair assumption.) Define $h : X \cup Y \rightarrow X \cup Y$ by $ h(z) = \begin{cases} f(z) & \text{ if } z \in X\\ z & \text { if } z \in Y \end{cases} $
Since $f$ is an injection, so is $h$. Now, $ h(X \cup Y) = h(X) \cup h(Y) = f(X) \cup Y \neq X \cup Y,$ where the inequality comes from the fact that $f(X) \neq X$.
If the assumption that $X$ and $Y$ are disjoint makes you uncomfortable, you can do without it by replacing $Y$ with $Y \setminus X$ in the definition of $h$ and throughout the proof.