Just adding another counterexample here that isn't using trigonometric functions. It is conceptually very simple. Imagine a smoothened staircase where each step is equally steep but the height of each step is half the size of the one before it. The height converges to a limit but no matter how far you go there are still steep steps so the derivative can't go to 0. Now let's create that staircase:
Take the spike-looking function $\delta$ such that $\delta(x) = \max(0,1-|x|)$. This is a continuous function. Note that its integral over the real line is 1.
Now define $f(x)$ to be a function with such spikes at each natural number, but with the spike at $n$ squeezed horizontally by a factor of $2^n$. That is,
$f(x) = \sum_{n=1}^{\infty} \delta(2^n(x-n))$.
Its integral $g$ would have
$$\lim_{x \to \infty} g(x) = g(0) + 1/2 + 1/4 + 1/8 + \cdots = g(0) + 1$$
but
$$\lim_{x \to \infty} f(x)$$ does not exist.