In most of the simple problems to solve, classic algorithms can give perfect and exact results. However, for complex cases, classic algorithms can’t give perfect result any more and the results are just roughly.
A machine learning model can be better than classic algorithm as it is fast. Imagine a classic algorithm functioning at certain order of complexity, eg. O(n^m), will be slower than ML model with simple feedforward only for inference, and the results are both the same, roughly-accurate results.
The more complex the problem to solve is, the better feedforward (inference) will out-perform classic algorithms.
An ML model takes a lot of time to learn, but the inference is fast.