This verse has a "relative" in surat ar-Ra'ad (13:11)
... Indeed, Allah will not change the condition of a people until they change what is in themselves ...
So in this verse
Allah affirms His perfect justice and fairness in His decisions, for He decided that He will not change a bounty that He has granted someone, except on account of an evil that they committed. Allah said in another Ayah (tafsir ibn Kathir)
ibn Achour in his tafsir at-tahriri wa tanwir added a few points: change here means exchanging something with it's opposite, so aslong as Pharao and those before have been good and doing good deeds Allah has given them HIs bounty, but once they started doing bad deeds and not correcting this wrong behavior Allah toke away His bounty and replaced it with (what they regard as) reprisal. And about the in this verse in first place adressed Quraish Allah showed His bounty towards them in 29:67
Have they not seen that We made [Makkah] a safe sanctuary, while people are being taken away all around them?...
so for Quraish this verse was a warning, which applies to us too if we stop Enjoining what is right and forbidding what is wrong!
Read also the verses 42:30 and 4:79 which show what ever good deeds we do or people do (starting at believing in Allah), or bad deeds we do it is from ourselves, so what we may gain from that is due to our acts or in cases due to our faineance (for example if we see others doing bad deed and we don't advice or try to correct them).
And Allah knows best!