Food security is a goal and means of global sustainable development, and an important component of China's national security. Based on grain production data from 2000 to 2020, 31 provinces (cities, autonomous regions) in China were used as research units to analyze the spatiotemporal differences and driving forces of grain production in China using a combination of local correlation index, center of gravity transfer model, and geographic detector. The results as follows, ① During the research period, China's total grain production showed a decrease followed by an increase, and the yield per unit area of grain showed an increasing trend. Corn has become the "largest staple food" in China; ② During the research period, the focus of China's grain production continued to shift northward, with Heilongjiang, Henan and Shandong provinces becoming the main grain production areas, with Henan being the province where China's grain production center was located. Among the factors affecting grain yield, the effective irrigation area (0.971) has the strongest explanatory power. Finally, countermeasures and suggestions were proposed from five aspects, stabilizing grain production, reducing grain inventory pressure, implementing regional grain security responsibilities, improving grain circulation efficiency, promoting high-quality grain engineering construction, adjusting grain production structure, strictly implementing farmland protection responsibilities, scientifically applying pesticides, fertilizers and other production materials, emphasizing agricultural infrastructure construction and stabilizing the number of agricultural labor force.