Leibniz used the chain rule first, and fumbled a sign doing it
If a car is twice as fast as a bicycle and the bicycle four times faster than a walker, the car beats the walker eightfold. That multiplication of rates is the chain rule of calculus. Leibniz first wrote it down in 1676, complete with a sign error in his worked example.
The rule tells you how to differentiate a function nested inside another. When one quantity depends on a second, and the second depends on a third, the rate at which the first changes against the third equals the product of the two intermediate rates. Leibniz's notation makes this look almost like cancelling fractions, which is part of why his symbols stuck.
The mathematician George F. Simmons gave the car, bicycle and walker comparison. Treat the three positions as variables: the car's position changes twice as fast as the bicycle's, and the bicycle's four times as fast as the walker's, so relative to the walker the car moves at two times four, or eight. Speeds are simply derivatives of position with respect to time, so dividing one speed by another is itself another application of the same rule.
Leibniz applied the idea to find the derivative of a square root wrapped around a simpler expression, recording it in a memoir of 1676. Guillaume de l'Hôpital relied on the rule without naming it in his Analyse des infiniment petits. Oddly, it is missing from every one of Leonhard Euler's analysis books, even though they came more than a century after Leibniz. What is usually taken as the first modern statement appears in Lagrange's Théorie des fonctions analytiques of 1797, and Cauchy included it in his 1823 lectures at the École Royale Polytechnique.
In its simplest form, if an inner function is differentiable at a point and the outer function is differentiable where the inner one lands, the combination is differentiable there too, with the derivative equal to the outer derivative times the inner. Longer chains of three or more functions are handled by peeling off one layer at a time. In integration, the matching technique is the substitution rule.
Source: Chain rule