וַיִּנָּ֖חֶם יְהוָ֑ה עַל־הָ֣רָעָ֔ה אֲשֶׁ֥ר דִּבֶּ֖ר לַעֲשׂ֥וֹת לְעַמּֽוֹ׃ (פ)
И Господь покаялся в зле, которое, как Он сказал, Он сделает Своему народу.
Ibn Ezra
G-d forbid that Hashem should repent! No, the Torah is merely speaking in a language that human beings can understand, just as it does when it says "He went up" (Genesis 17:22) and "He went down" (Genesis 11:5), and "God will be made happy by His creations" (Ps. 104:31). And also, "He was grieved in His heart" - and behold Samuel also said "The Glory of Israel does not deceive or change His mind" (I Samuel 15:29) And the text says "I repented". And there are those who explain this as an expression of communication, and this is unnecessary.
Or HaChaim
וינחם ה׳ על הרעה, "G'd reconsidered the evil He had said He would do, etc." The meaning of the verse is that there were two reasons why G'd reconsidered. 1) The decree was evil objectively speaking. 2) It would have resulted in evil for His people.
Haamek Davar
"And God had mercy" - from performing the total annihilation. But from that point there was a decree to destroy that generation, and the children would enter the Land of Israel, like there was the decree of the spies. And regarding this decree Moshe prayed for forty more days, as explained later with the help of Heaven.