How did Rome get sacked by the Visigoths in 410 and the Vandals in 455? Rome had never been captured by foreign forces since the Gauls in about 390 BC, about 800 years before AD 410.
How did Constantinople, "this city of the world's desire", get sacked by the Fourth Crusade in 1204 after beating off many besieging forces since it was founded 874 years earlier in 330?
How was Chang'an, the largest city in the world, capital of the mighty Tang dynasty of China, captured and briefly occupied by the An Lushan rebels in 756 and by Tibetan forces in 763?
How was Vijayanagara, one of the largest cities in the world and capital of the mighty Vijayanagara Empire, captured by the Deccan Sultanates, looted, burned, and its population enslaved and massacred, in 1565?
Such events do happen, and in each case there is a complicated specific situation and series of events that explain how those cities were captured by their enemies.