Overfitting happens when an algorithm only learns to fit the training data but doesn’t actually understand anything about underlying input-output, the algorithm basically just memorizes the training data. This is the opposite problem to underfitting.
The following is an example of an algorithm that generated an overfit function to the training data and a properly fit function
Overfit Function
Properly Fit Function