Statement: if $f(x)\ge0$ for all x, and $\int_a^\infty f(x)dx$ converges for some constant a>0, then $\lim_{x\to \infty} f(x)=0$.
The statement is in fact wrong, and I know it, but I mananged to give a proof and I don't know what is wrong about it.
My proof:
By contradiction,assume the limit is not 0. Then, there exsists some $\varepsilon_0>0$, and an $x_0$, such that for all $x>x_0$:
$|f(x)-0|=|f(x)|=f(x)\ge \varepsilon_0$.
Define $g(x)=\varepsilon_0$, we know that for all $x>x_0: g(x)\le f(x)$.
$\int_a^\infty g(x)dx=\lim_{M\to \infty} \varepsilon_0(M-a)=\infty$
Both functions are non-negative, therefore by the comparison test, the spoken integral of f(x) diverges, in contradiction to the fact that it converges.
The statemente is not true because you can pick a function such as follows.
$$ f(x)=\left\{ \begin{array}{} 1 \text{, if } x\in\mathbb{Q} \\ 0 \text{, if } x\in\mathbb{R}\setminus\mathbb{Q} \end{array} \right. $$
The function doesn't have a limit, still the integral converges.
In your proof instead you are assuming the function has a limit.