The exploration of the spatiotemporal variations and influencing factors of grain yield in major grain-producing regions is greatly important to maintain stable and sustainable agriculture. Taking Henan Province and Heilongjiang Province as examples, this study reveals the spatiotemporal characteristics of grain yield at the county level by using multisource data on the economy, society, and natural geography from 2000 to 2021 and employing methods such as coefficients of variation, standard deviational ellipses, and spatial autocorrelation analysis. Moreover, geographical detector and geographically weighted regression models are combined to explore the differences in significant influencing factors between these provinces and the spatial heterogeneity of regression coefficients, respectively. The following findings are drawn: (1) Grain yield in both provinces gradually increased, with notable differences in the annual growth rate, the proportion, and at the county level. (2) The number of high-yield counties significantly increased and their spatial distribution became more concentrated, indicating a notable shift in the main regions. (3) The overall spatial correlation of grain yield steadily increased, and the local spatial correlation transitioned from random distribution to gradual aggregation. (4) There were significant differences in the influencing factors, where geographical environment, socio-economic factors, and input factors all affected both provinces. In summary, this study provides a scientific reference for governments worldwide to formulate rational and effective food production policies, thereby contributing to global food security and sustainable social development.