Why is the derivative used to represent marginal cost instead of the difference?
The derivative is used in some contexts, but not all, when the cost function is differentiable. In those contexts, it tends to be assumed that supply is continuous, not discrete. This is a matter of convention and of analytic convenience. It has the advantage of being consistent, whether you're approaching the supply point from above or from below.

But in other contexts, given your cost function, assuming that the thing being supplied is discrete and not continuous (that is, it is possible to supply 2 units or 3 units, but not 2.9 or 3.5 or any other fractional unit) then the marginal cost of the third item is indeed 5, not 4.