Narrated Ibn 'Umar: that the Prophet ﷺ said: "Whoever learns knowledge for other than (the sake of) Allah, or intends by it other than Allah, then let him take his seat in the Fire".
The Prophet Muhammad ﷺ taught us that if we learn something without having a sincere intention or without seeking guidance from Allah, then it will not benefit us in any way and may even lead us astray. He warned us against using our knowledge to harm others or seek worldly gains instead of striving towards pleasing God Almighty. Therefore, it is important to keep our intentions pure when learning anything so that we can reap its full benefits both in this world and hereafter.