Let us proove the following theorem
Theorem: Assume $f:\mathbb{R}\to\mathbb{R}$ has a minimal period $T\in\mathbb{R}$, that
is, for all $x\in \mathbb{R} : f(x+T) = f(x)$. Then
$\lim_{x\to\infty}f(x)$ does not exist.
Proof: $T$ is minimal, thus, there is some $x_0\in\mathbb{R}$ such that $f(x_0) \ne f(x_0 + \frac12T)$. Choose the sequence $t_n = x_0 + \frac12nT$. We have that
$$ f(t_n) =
\begin{cases}
f(x_0) & \text{if } n \text{ is even} \\
f(x_0+\frac12 T) & \text{if } n \text{ is odd}
\end{cases} $$
and since $f(x_0) \ne f(x_0 + \frac12T)$ we get that the sequence $f(t_n)$ diverges when $n\to\infty$. From here we conclude that the limit $\lim_{x\to\infty}f(x)$ does not exist.
Now, regarding your question we have that $\lim_{x\to\infty} \cos\left(\frac1x\right) = \lim_{x\to0} \cos(x) = 1$ (by continuity of $\cos(x)$ at $x=0$), that is, the limit exists. Thus by the theorem above we conclude that $\cos\left(\frac1x \right) $ has no minimal period.
This can mean two things: either it has no period or it has infinitly many periods with no minimum. If it is the former case we are done. Hence, assume the latter. Continuous functions that have infinitely many periods with no minimum are constatnt (a nice exercise). Our function is continuous and is not constant and thus we reached a contradiction.
In total we have shown that $\cos\left(\frac1x \right)$ has no period. Perhaps this method is too long for this particular question, but assuming the rigorous background behind it is known, this trick can come pretty handy. (This answer was heavily influenced by @Sudix 's comment).