Let's say you want teach the computer to determine between good and bad products and give it the following dataset to learn:
0 means the product is faulty, 1 means it is OK. As you can see, there is a strong correlation between the X and Y axis. If the measured value is below or equal 50 it very likely (~98%) that the product is faulty and above it is very likley (~98%) it is OK. 52 and 74 are outliers (either measured wrong or not measured factors playing a role; also known as noise). The measured value might be thickness, temperature, hardness or something else and it's unit is not important in this example So the generic algorithm would be
if(I<=50)
return faulty;
else
return OK;
It would have a chance of 2% of misclassifying.
An overfitting algorithm would be:
if(I<50)
return faulty;
else if(I==52)
return faulty;
else if(I==74)
return faulty;
else
return OK;
So the overfitting algorithm would misclassify all products measuring 52 or 74 as faulty allthough there is a high chance that they are OK when given new datasets/used in production. It would have a chance of 3,92% of misclassifying. To an external observer this classificationmisclassification would be strange but explainable knowing the original dataset which was overfitted.
For the original dataset the overfitted algorithm is the best, for new datasets the generic (not overfitted) algorithm is most likely the best. The last sentence describes in basic the meaning of overfitting.