Here is the statement :
Let $f : \mathbb{R} \to \mathbb{R}$ a continuous function and $g$ a non constant periodic function in any open intervals of $\mathbb{R}$ such that $\lim_{x\to +\infty} g(f(x))= l \in \mathbb{R}$. Then $\lim_{x\to +\infty} f(x) = l' \in \mathbb{R}$.
For instance if I take $g \equiv \cos$ the statement is true.
For the general case I have no clue... Probably if the periodic function checks the bijection's theorem it seems to work.
Thanks in advance !
Let $f : \mathbb{R} \to \mathbb{R}$ be continuous s.t. $\lim_{x \to \infty} g(f(x))$ exists. Let $p>0$ be a periodic of $g$, i.e. $g(x+p)=g(x)$ for all $x$ s.t. $g$ is not constant on any non-trivial intervall.
First notice that $f$ doesn't divergence to $+ \infty$ (or $- \infty$). Assume $\lim_{x \to \infty} f(x) = + \infty$. Let $x_1 > f(0)$ and $x_2>f(0)$ s.t. $g(x_1) \neq g(x_2)$.
Let $(y_n)_n$ be a sequence s.t. $f(y_{2n})=x_1+np$ and $f(y_{2n+1})=x_2+np$. This is possible by the intermediate value theorem applied to $f$. Since $f$ is bounded on compact sets, $\lim_n y_n= \infty$. However, $g(f(y_{2n}))=g(x_1)$ and $g(f(y_{2n+1}))=g(x_2)$, hence $g(f(y_n))$ diverges, which is a contradiction.
If $\lim_{x \to \infty} f(x)$ doesn't exist in $[-\infty,+\infty]$, there are $a<b$ and sequences $(x_n)_n \to \infty$ and $(y_n)_n \to \infty$ s.t. $f(x_n)=a$ and $f(y_n)=b$ for all $n$. By passing to subsequences we can assume $x_1 <y_1 <x_2 < y_2 < ...$
If $g(a) \neq g(b)$, this is a contradiction to the existence of $\lim_{x \to \infty} g(f(x))$.
Otherwise, we can find $c \in (a,b)$ s.t. $g(c) \neq g(a)$, since $g$ isn't constant on intervalls. By the intermediate value theorem applied to $f$ we ge a sequence $(z_n)_n$ s.t. $x_1<y_1<z_1<x_2<y_2<z_2<...$ and $f(z_n)=c$. This yields the same contradiction to the existence of $\lim_{x \to \infty} g(f(x))$.