The goal is to prove that $A\subseteq A\cup B$.
Now, consider the statement that if $X\cup Y=Y$, then $X\subseteq Y$. Working backwards, in order to get $A\subseteq A\cup B$ as the conclusion, you must use $X=A$ and $Y=A\cup B$.
Now, we must check the hypothesis of the statement above, in other words, one must show that $X\cup Y=Y$ or that $A\cup(A\cup B)=A\cup B$. However, this is true as you state.
Therefore, since $X$ and $Y$ are arbitrary in the statement above, using the special case where $X=A$ and $Y=A\cup B$, we get exactly the desired conclusion. Therefore, we choose the $X=A$ and $Y=A\cup B$ in order to engineer that the desired conclusion occurs - $X$ and $Y$ are variables and we can choose them however we wish.