I honestly can't say precisely how Leibniz or Newton did that, but the proof of the "Fundamental Theorem of Calculus" is given in any calculus book.

Roughly speaking:
First, you show that the "Riemann sum method" (which was developed long after Newton or Leibniz) does in fact give the "area under the curve". You can do that by choosing the height of the rectangles over any interval to be the largest value of the function on that interval so that the sum of the areas of the rectangles, Inn is clearly greater than the area under the curve. Then you turn around and choose the height of the rectangles to be the smallest value of the function on that interval so that the sum of the areas of the rectangles, In, is clearly less than the area under the curve. A function is said to be "Riemann Integrable" if, in the limit as the number of intervals goes to 0, In and In both have the same limit. Since one is always larger than the area and the other is always lower, the common limit must be the area.

Now, given a value x0, consider the area under the curve, between x0 and x0+ h. you can show that area is the difference between the integrals, I(x]sub]0[/sub] and I(x0+h). Further, using the mean value theorem, you can show that is the area of a rectangle of of base h and height f(x*) where x* is some (unknown) value between x0 and x0+ h. That is, I(x0+ h)- I(x0)= hf(x*) so (I(x0+h)- I(x0))/h= f(x*). Finally, take the limit on both sides as h goes to 0. On the left we get I'(x) and on the right, since x* is always between x0 and x0+ h, and h is going to 0, we have f(x). That is I'(x)= f(x)- the derivative of the integral is the original function.