The unique structure of ancient buildings poses a significant risk of fire hazards, so the assessment of potential fire risk is of great significance to fire safety management. This paper examines the fire risk associated with the building complex of the Palace Museum. Firstly, a fire risk assessment indicator system was constructed based on three dimensions: hazard factors, sensitivity of hazard-bearing bodies, and loss control factors. Secondly, the weight values for each index were calculated based on the entropy weight method. Finally, the monthly fire risk assessment levels in the year 2019 were visualized by using a geographic information system. Based on the fire risk assessment results, this study quantitatively reveals the fire risk driving mechanism of ancient buildings in the Palace Museum from the perspective of spatial stratified heterogeneity by using the geodetector model. The results show that there are differences between the main factors that affect the weight of fire risk assessment and the main factors that cause the spatial heterogeneity of fire risk. Factors such as the safety protective grade and staff number contribute to a stronger explanation of the spatial stratified heterogeneity for fire risk within the museum. The results can help us to understand the driving factors affecting the distribution patterns of fire risk for the Palace Museum and could provide support for the formulation of fire prevention and safety management measures.