The identification of waterlogging driving factors and the assessment of associated risks are of utmost importance to enable cities to sustain their development. Initially, this paper utilizes the kernel density estimation (KDE) technique to visually display the spatial distribution features of waterlogging points within the downtown region of City B. Employing a spatial analysis method, the examination through the application of Global Moran's I reveals that the central urban area of City B exhibits a spatial clustering distribution. Moreover, nine influencing factors, including terrain characteristics, land cover features, and infrastructure construction aspects, are chosen as the elements that drive the continual occurrences of waterlogging due to rainstorms incidents. By applying the geographic detector (GD) and random forest regression (RF) models, an in-depth exploration into the agents leading to rainstorm waterlogging is conducted. The outcomes demonstrate that the surface impervious rate stands out as the primary factor. Additionally, under the geographic detector model, it has been verified that the integrated effect of two factors is more significant than that of a solitary factor, with the interaction between the surface impervious rate and community density having the most prominent influence on waterlogging situations within the investigated area. Finally, through the utilization of the random forest model, the sensitive areas inclined to experience waterlogging in the investigated area are demarcated. The findings of this research can offer valuable references for the management of urban rainstorm waterlogging as well as the sustainable development of cities.