In the era of globalization, digitalization, and diversification, currently societal cities face risks intertwined by uncertainty and complexity. Thus, it is crucial to address risks concerns to achieve modernization of spatial management. Moreover, how to scientifically identify the risk pattern of territorial space and how to map and control it in space becomes a critical and urgent issue to be addressed for achieving modernization of spatial management. Understanding the intricate relationship between land use, environmental factors, and population density is essential for identifying risk patterns that can inform effective disaster management strategies. By employing advanced analytical methods, this study aims to provide a comprehensive framework for recognizing and mitigating territorial spatial risks in an increasingly complex urban landscape. This study used a case study to conduct the unsupervised algorithm of stack autoencoder self-organizing map to analyze the distribution and spatial clustering of Shenzhen's land spatial risk pattern and reveal the driving mechanism of its risk pattern formation in detail. It was found that: (1) The overall territorial spatial risk pattern of Shenzhen presents a distribution trend of "high in the west and low in the east, high in the south and low in the north"; that is, I and II risk areas are clustered in the hilly areas in the northeast and IV and V risk areas in the coastal areas in the southwest; (2) Population density, land use intensity, seawater intrusion, geological disasters, relief amplitude, soil type, soil erosion intensity are the main driving forces for the formation of Shenzhen's territorial spatial risk pattern. In particular, seawater intrusion, population density and land use intensity, soil type were found having significantly synergistic impact on the risk pattern.