I'm having a hard time understanding why the following lemma is true:
If a $f(x)$ is continuous on $[a,b]$, and if $$\int_a^b f(x)g(x) \,dx = 0 $$ for every function $g(x)$ continuous on $[a,b]$ such that $g(a) = g(b) = 0$, then $f(x) = 0$ for all $[a,b]$.
Now lets say $f(x) = 5$ and $g(x) = \sin(x)$, then $ \displaystyle\int_0^{2\pi} f(x)g(x)\, dx = 0 $, both $f(x)$ and $g(x)$ are continuous $[0, 2\pi ]$, but $f(x) \neq 0$.
You are missing the "for every continuous function $g(x)$".
You take any continuous function $g$ (such that $g(a) = g(b) = 0$). Compute the integral, and find that it is zero! Now you need to show that this implies $f$ is the constant function $0$.
In your example, Pp gave an example of $g$ where $f(x) = 5$ gives a non-zero integral.