The influenza A (H7N9) virus has been seriously concerned for its potential to cause an influenza pandemic. To understand the spread and evolution process of the virus, a spatial and temporal Bayesian evolutionary analysis was conducted on 2,052 H7N9 viruses isolated during 2013 and 2018. It revealed that the H7N9 virus was probably emerged in a border area of Anhui Province in August 2012, approximately 6 months earlier than the first human case reported. Two major epicenters had been developed in the Yangtze River Delta and Peral River Delta regions by the end of 2013, and from where the viruses have also spread to other regions at an average speed of 6.57 km/d. At least 24 genotypes showing have been developed and each of them showed a distinct spatio-temporal distribution pattern. Furthermore, A random forest algorithm-based model has been developed to predict the occurrence risk of H7N9 virus. The model has a high overall forecasting precision (> 97%) and the monthly H7N9 occurrence risk for each county of China was predicted. These findings provide new insights for a comprehensive understanding of the origin, evolution, and occurrence risk of H7N9 virus. Moreover, our study also lays a theoretical basis for conducting risk-based surveillance and prevention of the disease.