To see how this works, think about a smooth curve in the number plane, such as the one shown below.
No matter how curvy it is, if you keep zooming in it eventually straightens out and begins to locally look more and more like a line. (Compare this to the situation with non-smooth fractal curves.) The question we need to answer is what is the slope of each of these zoomed-in, local line components of the original curve?
The answer is the instantaneous rate of change at the point, i.e. the slope of the tangent at the point, and doing this formally is called calculating a derivative.
The basic idea comes from the equation of a line: \(y - y_0 = m (x - x_0)\). Given a curve \(y = f(x)\), we zoom in and look at the secant from \(x\) to \(x + \Delta x\). The end points of this secant are \((x, f(x))\) and \((x + \Delta x, f(x + \Delta x))\), and substituting them into the equation of a line gives us $$f(x + \Delta x) - f(x) = m (x + \Delta x - x) = m \Delta x.$$
We are interested in the rate of change, that is the slope of the secant line \(m\), and so we can rearrange and get $$m = \frac{f(x + \Delta x) - f(x)}{\Delta x}.$$
The breakthrough of calculus was introducing the ability to consider this line in the limit that \(\Delta x\) becomes infinitely small. Both the numerator and denominator of this expression go to zero, but if the function \(f(x)\) is suitably well behaved at the point \(x\) (and most important functions are), the limit has a meaningful value. We call this the derivative and write: $$f'(x)=\frac{dy}{dx}=\lim_{\Delta x \rightarrow 0}\frac{f(x + \Delta x) - f(x)}{\Delta x}$$
The activity below demonstrates how in the limit \(\Delta x \rightarrow 0\) the slope of the secant line becomes the tangent slope.