It is narrated from Sayyiduna Mu'awiyah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Whomever Allah intends good for, He grants him understanding of the religion."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 16909