If we let the tree grow without any limit, it will keep splitting until every leaf contains only a single training sample. On training data this gives perfect accuracy, but the model has essentially memorised the data rather than learned a general pattern — a problem called overfitting.
A larger ccp_alpha removes more branches; tuning it with cross-validation gives you a principled way to find the right level of complexity.
Decision trees are an excellent starting point in any ML toolkit: they are transparent, require minimal data preprocessing (no feature scaling needed), and form the building blocks of more powerful ensemble methods — Random Forests and Gradient Boosted Trees — which we will explore in the next section.