A model that learns its training examples too precisely can fail on anything new, because it has memorised quirks rather than learning the general pattern. This is overfitting, and it shows up as excellent scores on familiar data and poor results in the real world.
The cure is to test on data the model never trained on, and to favour simpler models and techniques that discourage memorising. The goal is generalisation: performing well on cases the model has not seen, which is the only performance that matters in use.