Overfitting occurs when the tree model becomes too complex and captures noise in the data, leading to poor generalization.