(ذَٰلِكَ) (That is): Refers to what was stated before. Allah (swt) warned them, made promises, and sent the Messengers.
( أَن لَّمْ يَكُن رَّبُّكَ مُهْلِكَ الْقُرَىٰ بِظُلْمٍ) (because your Lord would not destroy the cities for wrongdoing): Allah (swt) would not destroy a city before warning its people. We should mention here that there is a difference between a good person and a reformer. A good person is someone who works to improve himself, while a reformer is someone who works to improve others and to save them from heedlessness. Even before the Message was revealed to the Prophet (saws), Meccah and the Quraishi had already knew him to be a good, trustworthy, and an honest person. However, after the Message was revealed and he (saws) wanted to reform people, they started accusing him of being a wizard, a crazy person, and a liar. This is because people do not want anyone to wake them up from their delusions, fantasies and desires, and this is why the war on desires is so violent. For this reason, Allah (swt) makes that distinction by saying:
وَمَا كَانَ رَبُّكَ لِيُهْلِكَ الْقُرَىٰ بِظُلْمٍ وَأَهْلُهَا مُصْلِحُونَ
(And your Lord would not have destroyed the cities unjustly while their people were reformers.) (Hud: 117)
He (swt) did not say: (were good) because there must be a calling for goodness towards others.
The verse here says:
(ذَٰلِكَ أَن لَّمْ يَكُن رَّبُّكَ مُهْلِكَ الْقُرَىٰ بِظُلْمٍ وَأَهْلُهَا غَافِلُونَ) (That is because your Lord would not destroy the cities for wrongdoing while their people were unaware): Unaware because no Messengers from Allah (swt) were sent to them. Allah (swt) does not punish without a scripture, nor before sending Messengers and informing them to be reformers. When Adam, peace be upon him, came down to earth from Paradise, he conveyed the true path of Allah (swt). But after that, corruption began on earth, which makes corruption extrinsic and manmade. Allah (swt) says:
ظَهَرَ الْفَسَادُ فِي الْبَرِّ وَالْبَحْرِ بِمَا كَسَبَتْ أَيْدِي النَّاسِ لِيُذِيقَهُم بَعْضَ الَّذِي عَمِلُوا لَعَلَّهُمْ يَرْجِعُونَ
(Corruption has appeared throughout the land and sea by [reason of] what the hands of people have earned so He may let them taste part of [the consequence of] what they have done that perhaps they will return [to righteousness].) (Ar-Room: 41)