Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:62:2

It is He who has sent among the unlettered a Messenger from themselves reciting to them His verses and purifying them and teaching them the Book and wisdom - although they were before in clear error -  

It is He Who sent to the unlettered ˹folk˺, ˹among˺ the Arabs (ummī means ‘one who cannot write or read a book’), a messenger from among them, namely, Muhammad (s), to recite to them His signs, the Qur’ān, and to purify them, to cleanse them from idolatry, and to teach them the Book, the Qur’ān, and wisdom, ˹in˺ the rulings that it contains, though indeed (wa-in: in has been softened from the hardened form, with its subject having been omitted, that is to say, ˹understand it as˺ wa-innahum) before that, ˹before˺ his coming, they had been in manifest error.
القرآن:٦٢:٢

هُوَ الَّذِي بَعَثَ فِي الْأُمِّيِّينَ رَسُولًا مِنْهُمْ يَتْلُو عَلَيْهِمْ آيَاتِهِ وَيُزَكِّيهِمْ وَيُعَلِّمُهُمُ الْكِتَابَ وَالْحِكْمَةَ وَإِنْ كَانُوا مِنْ قَبْلُ لَفِي ضَلَالٍ مُبِينٍ  

{هو الذي بعث في الأميين} العرب، والأمي: من لا يكتب ولا يقرأ كتابا {رسولا منهم} هو محمد ﷺ {يتلو عليهم آياته} القرآن {ويزكيهم} يطهرهم من الشرك {ويعلمهم الكتاب} القرآن {والحكمة} ما فيه من الأحكام {وإن} مخففة من الثقيلة واسمها محذوف، أي وإنهم {كانوا من قبل} قبل مجيئه {لفي ضلال مبين} بيّن.

See similar narrations below:

Collected by Qurʾān
quran:2:129

Our Lord, and send among them a messenger from themselves who will recite to them Your verses and teach them the Book and wisdom and purify them. Indeed, You are the Exalted in Might, the Wise."  

Our Lord! And send among them, the people of this House, a messenger, one of them and God granted him this petition with ˹the sending of˺ Muhammad (s), who shall recite to them Your signs, the Qur’ān, and teach them the Book, the Qur’ān, and Wisdom, that is, what the former contains of judgments, and purify them, cleanse them of idolatry; You are the Mighty, the Victor, the Wise, in His creation.
القرآن:٢:١٢٩

رَبَّنَا وَابْعَثْ فِيهِمْ رَسُولًا مِنْهُمْ يَتْلُو عَلَيْهِمْ آيَاتِكَ وَيُعَلِّمُهُمُ الْكِتَابَ وَالْحِكْمَةَ وَيُزَكِّيهِمْ ۚ إِنَّكَ أَنْتَ الْعَزِيزُ الْحَكِيمُ  

{ربنا وابعث فيهم} أي أهل البيت {رسولا منهم} من أنفسهم وقد أجاب الله دعاءه بمحمد {يتلو عليهم آياتك} القرآن {ويعلمهم الكتاب} القرآن {والحكمة} أي ما فيه من الأحكام {ويزكيهم} يطهرهم من الشرك {إنك أنت العزيز} الغالب {الحكيم} في صنعه.
quran:3:164

Certainly did Allah confer ˹great˺ favor upon the believers when He sent among them a Messenger from themselves, reciting to them His verses and purifying them and teaching them the Book and wisdom, although they had been before in manifest error.  

Truly God was gracious to the believers when He sent to them a messenger from among their own, that is to say, an Arab like them, not an angel or a non-Arab, so that they can understand what he says and feel honoured thereby, to recite to them His verses, the Qur’ān, and to purify them, to cleanse them of sins, and to teach them the Book, the Qur’ān, wisdom, the Sunna, though (in, is softened ˹in place of inna˺, that is, innahum, ‘though they…’) before, that is, before he was sent, they were in clear error.
القرآن:٣:١٦٤

لَقَدْ مَنَّ اللَّهُ عَلَى الْمُؤْمِنِينَ إِذْ بَعَثَ فِيهِمْ رَسُولًا مِنْ أَنْفُسِهِمْ يَتْلُو عَلَيْهِمْ آيَاتِهِ وَيُزَكِّيهِمْ وَيُعَلِّمُهُمُ الْكِتَابَ وَالْحِكْمَةَ وَإِنْ كَانُوا مِنْ قَبْلُ لَفِي ضَلَالٍ مُبِينٍ  

{لقد منَّ الله على المؤمنين إذ بعث فيهم رسولا من أنفسهم} أي عربيا مثلهم ليفهموا عنه ويشرُفوا به لا ملكا ولا عجميا {يتلو عليهم آياته} القرآن {ويُزكِّيهمْ} يطهرهم من الذنوب {ويعلمهم الكتاب} القرآن {والحكمة} السنة {وإن} مخففة أي إنهم {كانوا من قبلُ} أي قبل بعثه {لفى ضلال مبين} بيِّن.