As an important water supply source in Beijing, karst groundwater has played an irreplaceable role in the security of urban water supply and ecological environment protection in the past 70 years. The Xishan karst groundwater system, located in the upper reaches of western Beijing, belongs to ecological conservation areas. There are several centralized water supply fields in this area. In this study, the Xishan karst groundwater system was taken as the research object. A total of 120 karst groundwater samples in this area were investigated by using statistical analysis, ion ratio, and principal component analysis (PCA) methods to explore the spatial distribution characteristics and formation mechanism of groundwater hydrochemistry. The research results showed that: ① the groundwater quality of the Xishan system was generally good, with the characteristics of neutral pH and low salinity. A total of 84.17% of the water samples were classified as hard water. The chemical type of groundwater was mainly HCO3-Ca·Mg. ② The chemical composition of groundwater was mainly affected by the water-rock interaction, and the weathering source of rock was mainly the dissolution of carbonate. ③ The results of principal component analysis showed that 34.41% of the chemistry formation of groundwater could be explained by carbonate dissolution, 27.33% by rock salt and evaporate dissolution, 11.76% by aquifer sediment dissolution, and 10.30% by domestic sewage discharge. From the recharge area to the runoff area and then to the discharge area, the TH and TDS gradually increased. Coal mining drainage and human activities were the main factors that caused groundwater degradation and variable hydrochemical types in the piedmont. In the future, it is necessary to further strengthen environmental governance, control point and non-point source pollution, and continuously monitor key areas to provide scientific support for ecological and environmental protection.