Zero integral of measurable $f$ on every interval implies $f=0$?
The mosquito-nuking solution: the integral defines a signed measure on $\Bbb R$: $$\mu(A) = \int_A f = 0.$$ (the $ = 0$ can be proved easily)
By the a.e. uniqueness of the Radon–Nikodym derivative, $f = 0$ a.e.
Consider the Borel measure $\mu(A)=\int_Af$. We have $$ \mu(A)=\inf\sum_{n=1}^\infty\int_{I_n}f, $$ where the infimum is taken over all countable covers of $A$ by intervals $I_n$. So $\mu(A)=0$ for every $A$. Now it suffices to consider the Borel sets where $f>0$ and where $f<0$.
You need to assume that $f$ is locally integrable (or that $f\ge0$) for this to make sense.
Supposing that: It follows by DCT (or MCT) that $\int_V f=0$ for every bounded open set $V$, since any such $V$ is a countable disjoint union of open intervals. Hence $\int_K f=0$ for every compact $K$, since $K=V_1\setminus V_2$ where $V_1$ and $V_2$ are bounded open sets with $V_2\subset V_1$.
Now assume $f$ is real-valued. Let $E_n=\{x:f(x)>1/n\}$. If $m(E_n)>0$ then there exists a compact $K\subset E_n$ with $m(K)>0$, and hence $\int_K f>0$, contradicting the above. So $m(E_n)=0$. So the union of the $E_n$ has measure zero, hence $f\le 0$ almost everywhere. Similarly $f\ge0$ almost everywhere.