The development and subsistence strategies adopted in ancient settlements are crucial to the understanding of long-term human–environmental interaction in the past. Here, we reassess the chronology of the ancient walled settlement of Sanjiao in the Hexi Corridor in northwestern China through accelerator mass spectrometry radiocarbon (AMS 14C) dating and explore the subsistence of the settlers inside through the identification of carbonized seeds and charcoal. In addition, high-resolution paleoclimate records in the Hexi Corridor and nearby regions are employed to explore the reason for the construction of Sanjiao. Our results show that Sanjiao was built around 828 cal BC and remained inhabited through 384–116 cal BC. This indicates Sanjiao is the earliest known walled settlement in the Hexi Corridor. Ancient people at Sanjiao consumed crops such as barley, broomcorn millet, and foxtail millet, and used wood from Tamarix chinensis, Tamarix, Salix, Picea, Hippophae, Betulaceae, and Poaceae as fuel. The construction date of Sanjiao correlates with climate deterioration and social upheavals in the Hexi Corridor, potentially suggesting a defensive purpose for the site.