Build a new function by accumulating area. Its slope tells you the height of the original function.
A small extra interval of width h contributes approximately f(x)h. Divide this area change by h and take a limit. Continuity of f makes the average height approach f(x).
Accumulated area can decrease when the integrand is negative.
Green is the integrand. The blue accumulation curve has slope f(x) at the selected upper bound.