Language:
كتاب العلم
3  
Knowledge
(13)
Chapter: If Allah Jalla Jalalahu wants to do good to a person, He makes him comprehend (the religion). [The understanding of the Qur'an and As-Sunna (legal ways) of the Prophet (Muhammad (saws))]
(13)
باب مَنْ يُرِدِ اللَّهُ بِهِ خَيْرًا يُفَقِّهْهُ فِي الدِّينِ
Sahih al-Bukhari 71

Narrated Muawiya:

I heard Allah's Messenger (ﷺ) saying, "If Allah wants to do good to a person, He makes him comprehend the religion. I am just a distributor, but the grant is from Allah. (And remember) that this nation (true Muslims) will keep on following Allah's teachings strictly and they will not be harmed by any one going on a different path till Allah's order (Day of Judgment) is established."

حَدَّثَنَا سَعِيدُ بْنُ عُفَيْرٍ، قَالَ حَدَّثَنَا ابْنُ وَهْبٍ، عَنْ يُونُسَ، عَنِ ابْنِ شِهَابٍ، قَالَ قَالَ حُمَيْدُ بْنُ عَبْدِ الرَّحْمَنِ سَمِعْتُ مُعَاوِيَةَ، خَطِيبًا يَقُولُ سَمِعْتُ النَّبِيَّ صلى الله عليه وسلم يَقُولُ ‏ "‏ مَنْ يُرِدِ اللَّهُ بِهِ خَيْرًا يُفَقِّهْهُ فِي الدِّينِ، وَإِنَّمَا أَنَا قَاسِمٌ وَاللَّهُ يُعْطِي، وَلَنْ تَزَالَ هَذِهِ الأُمَّةُ قَائِمَةً عَلَى أَمْرِ اللَّهِ لاَ يَضُرُّهُمْ مَنْ خَالَفَهُمْ حَتَّى يَأْتِيَ أَمْرُ اللَّهِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 71
In-book reference : Book 3, Hadith 13
USC-MSA web (English) reference : Vol. 1, Book 3, Hadith 71
  (deprecated numbering scheme)