If a continuous function $f(x)$ of a real variable $x$ is such that $f(x)\rightarrow 0$ as $x\rightarrow \pm \infty$, does it necessarily mean that $\frac{df}{dx}\rightarrow 0$ as $x\rightarrow \pm \infty$? If yes, can I prove this?
If not, what is a counter-example where this is not true. The examples, I can think of $\frac{1}{x}, e^{-x}$ etc satisfy this.

No. Consider the following:
$$f(x)=\frac{\sin(e^x)}x$$
as $x\to\pm\infty$, $f(x)\to0$. However,
$$f'(x)=\frac{xe^x\cos(e^x)-\sin(e^x)}{x^2}\to\text{DNE as }x\to+\infty$$
Here is the graph: