SKLEARN GridSearchCV hinting higher accuracy than Pipeline but with same parameters as Pipeline estimators
The GridsearchCV object in sklearn does a cross-validation on the data you feed it during your fit. In your case you have specified cv=5: this means GridSearchCV splits your data into train/test splits 5 times and reports on the mean performance over those 5 trials to be 0.868.
You asked why GridSearchCV knows the best parameters without feeding it testing data - this is because it's taking your training data &amp; splitting that into a smaller subset of train/test splits (5 of them to be exact).
You are then evaluating the best model on the testing set and getting accuracy of 0.805. This can happen if the single train/test split you performed split the data in a way that causes some of the more difficult samples to predict to be put in the testing set. If you were to perform the same cross-validation your GridSearchCV performed (say with cv=5) you might find the average performance to be a little higher and closer to the 0.868 it cited.