Overall meaning :
Allah, Exalted be He, instructs His Prophet to relate to his people the story of the man to whom Allah Almighty had given knowledge of His revelations, but he turned away from them, so Satan overtook him, made him one of his followers and thus he went astray. Had it been Allah’s will, He would have raised him to an exalted position by means of these revelations, but he clung to this earthly life and its pomp and glitter and followed the falsehood that his whims and desires dictated to him. The case of such a person who does not change whether or not he is admonished is like that of a dog, which pants with its tongue hanging out whether you drive it away or leave it alone. Such is the example of those who deny Allah’s revelations. Allah then instructs His Prophet to relate to his people and to the Jews the stories of the past nations He recounts to him in the Qur’an to reflect on them and to turn away from unbelief and the path of error.
Evil indeed is such likeness shown of those who deny Allah’s revelations and wrong themselves by subjecting themselves to Allah’s chastisement. Whomever Allah guides are truly guided, but those He leads astray are the losers in this life and in the hereafter.