Ground source heat pump (GSHP) system, which extracts underground heat for building heating and cooling, uses renewable energy to decrease CO2 emissions for the goals of carbon peaking and carbon neutrality. Hence, the prediction and optimization work is significate especially for existing GSHP system. This study focuses on the prediction of heat extraction and optimization of operational strategy based on a three-story house installed with GSHP system located in Cleveland, Ohio, USA. Firstly, the numerical model is built to simulate operation of ground heat exchanger (GHE). Then, Latin hypercube sampling (LHS) is employed to generate different parameter combinations that are calculated to get the heat extraction results for training XGBoost-based surrogate model. Finally, the particle swarm optimization (PSO) is used to realize the optimization of operational strategy. The results indicate that the numerical model can simulate the GHE well, and the accuracy of surrogate model can reach 0.990. The COP of GSHP system is maximized to protect the soil heat balance and reduce the electrical energy consumption. The optimization method also makes it possible to evaluate the heat extraction capability, and prepare for the extra heat demand in advance.