The Messenger of Allah ﷺ said, "Whoever Allah intends good for, He gives him understanding of the religion. I am only one who distributes, and it is Allah who gives."
Ahmad 7194
Sahih
قال من يرد الله به خيرا يفقه في الدين وإنما أنا قاسم ويعطي الله عز وجل