The heritage of ancient buildings is an important part of the world’s history and culture, which has extremely rich historical–cultural value and artistic research value. Beijing has a large number of ancient palace buildings, and because of the age of their construction, many of them have problems with varying degrees of peeling and molding on the inner surfaces of the envelope. To solve the problems of damp interiors of palace buildings, a mathematical model of indoor heat and moisture transfer was established based on an ancient wooden palace building in Beijing. The model was validated by fitting the measured and simulated data. And the effects of outdoor relative humidity, soil moisture, wall moisture, and other factors on indoor heat and moisture transfer of ancient buildings were simulated and analyzed via the control variables method. The results showed that the measured and simulated data are within the error range, which verifies the accuracy of the model. And the simulation of indoor humidity matched the measured humidity. Thus, the simulation results were consistent with the actual situation. The variable trend of the relative humidity of the indoor environment with the outdoor humidity is inconsistent from plane to plane, i.e., it increases or remains constant with the increase in the outdoor humidity. Indoor ambient relative humidity increased with increasing wall moisture. And the indoor average temperature is 24.5 °C, and indoor relative humidity ranged between 87.4% and 92.4%. Soil moisture and wall moisture were the main factors affecting indoor relative humidity.