The integral is very closely related to a sum almost like your one, called the Riemann sum. Instead of just adding up the values of the function at different points, the integral adds up the areas of rectangles whose height is one function evaluation, and width is the distance between there and the next one (which is a fixed $\delta x$). It looks like this:
$$ \sum_{i=0}^{N} f(x_i)\delta x \;\;\;\;\;\; \text{where}\;\; x_i = x_0 + i\delta x $$
The integral is defined roughly as "what happens when the width of these rectangles get really small", which becomes a better approximation of the area under the curve (since more narrower rectangles will conform to the curve better than fewer wider ones). In formal terms, the integral is the limit of the Reimann sum (analogously to how a derivative is the limit of an average gradient):
$$ \int_{x_0}^{x_N} f(x) dx = \lim_{\delta x \to 0} \sum_{i=0}^N x_i \delta x$$
Looking at it in these terms, the difference between the sum and the integral in your question is exactly the difference between that sum and the (limit of the) Reimann sum.