Sometimes you really don't know how to calculate the derivatives.
But perhaps more often, even if in principle you could do the additional work, formulate how to calculate derivatives, and add the required extra code, you just don't want to invest the additional resources, when you can just call a derivative-free optimization library. The optimization will run slower, but perhaps you have some extra seconds so spare.
Sometimes you really don't know how to calculate the derivatives.
But perhaps more often, even if in principle you could do the additional work, formulate how to calculate derivatives, and add the required extra code, you just don't want to invest the additional resources, when you can just call a derivative-free optimization library. The optimization will run slower, but perhaps you have some extra seconds so spare.