Window opening behaviour is an important factor which affects the consumption of building energy. Finding out the driving factors and establishing an accurate model for window opening behaviour can improve the accuracy of the simulation of building energy consumption. However, the window opening behaviour is affected by various driving factors and has strong uncertainty, which brings difficulties for the dynamic simulation of building energy consumption. Residential buildings that were chosen had a similar number of residents, and indoor and outdoor environmental parameters and states of the windows were monitored for one year in Xi’an. The multi-factor variance method was used to analyse the influence of environmental factors, and logistic regression and back propagation neural network models were established for different seasons. The study found that the window opening frequency in the bedroom is higher than in the living room. The driving factors which affect window opening behaviour vary with seasons, and indoor and outdoor temperatures and humidity are the dominant factors. The accuracy of the proposed BP neural network models is above 70%, and the area under curve value is all above 0.7. These models can provide theoretical support for the modelling of the residential building in Xi’an.