In general, if you are to calculate
$$
\lim_{x \to a} [f(x) + g(x)]
$$
where $a$ can be a real number or $\pm \infty$, you cannot blindly move the limit inside the parantheses like this:
$$
\Big[\lim_{x\to a} f(x) + \lim_{x \to a} g(x) \Big]
$$
The reason you can not do that is because when proving this limit rule it is assumed that both
$$\lim_{x\to a} f(x)$$
and
$$
\lim_{x \to a} g(x)
$$
are defined. To be defined in this context means that they actually are equal to a real number (they converge). If any one of them, say $\lim_{x \to \infty} f(x)$, does not converge to any real number, it could be because for example:
$\lim_{x \to \infty} f(x)$ oscillates between several different values as $x$ goes to $\infty$, and thus does not settle for a limit value. An example of this is the function $\cos(x)$.
$\lim_{x \to \infty} f(x) $ does not have an upper bound. That is, no matter what number $M$ you come up with, there is a point $x_0$ on the real line such that $f(x) > M$ whenever $x > x_0$.
In this latter case we might informally write this as $\lim_{x \to \infty} f(x) = \infty$, but note that this is just notation. $\infty$ is not a number that one can do arithmetic with as with real numbers. What the notation really means is once again that $f(x)$ grows without limit if we only increase $x$ enough. Therefore, an expression such as $\infty - \infty$ does not have any mathematical meaning, because $\infty$ is just a symbol and not a number.
The same caution applies to many other limit rules such as $\lim_{x \to a}(f(x)g(x)) = \lim_{x \to a}f(x) \lim_{x \to a}g(x)$, because you encounter the same problems of doing arithmetic with the symbol $\infty$ otherwise.
One can sometimes convert a limit where the variable goes to $\infty$ to a limit where the variable goes to $0$ by doing a change of variables. In this case, we can make the change of variables $u = \dfrac{1}{2x}$. It is then true that $u \to 0$ when $x \to \infty$. The limit calculation becomes
\begin{align}
&\lim_{x\to \infty} \Big[ x^2 - x^2 \cos(\frac{1}{x}) \Big] =\\
&\lim_{u \to 0} \Big[\dfrac{1}{4u^2} - \dfrac{1}{4u^2}\cos(u + u) \Big] = \\
&\lim_{u \to 0} \Big[\dfrac{1}{4u^2} (1 - \cos(u)^2 + \sin(u)^2) \Big] = \\
&\lim_{u \to 0} \dfrac{2 \sin(u)^2}{4u^2} = \\
&\lim_{u \to 0}\dfrac{1}{2} \lim_{u \to 0}\dfrac{\sin(u)}{u} \lim_{u \to 0}\dfrac{\sin(u)}{u} = \\
&\dfrac{1}{2} \cdot 1 \cdot 1 = \dfrac{1}{2} \\
\end{align}
Where we have used the facts that
- $\lim_{u \to 0}\dfrac{1}{2}$ and the standard limit $\lim_{u \to 0}\dfrac{\sin(u)}{u}$ are real numbers.
- $\cos(u + u) = \cos(u)^2 - \sin(u)^2$
- $1 = \cos(u)^2 + \sin(u)^2$