It is narrated on the authority of Abu Hurairah (RA) that the Messenger of Allah (ﷺ) (may peace and blessings be upon him) observed: Do not detest your fathers; he who detested his father committed infidelity.
Hadith Referenceصحيح مسلم / كتاب الإيمان / 62
Hadith Gradingمحدثین:أحاديث صحيح مسلم كلها صحيحة
Hadith Takhrij«أحاديث صحيح مسلم كلها صحيحة ، أخرجه البخاري فى ((صحيحه)) فى الفرائض ، باب: من ادعي الی غير أبيه برقم (6386) انظر ((التحفة)) برقم (14154) »
Narrated Abu Huraira: The Prophet said, "Do not deny your fathers (i.e. claim to be the sons of persons other than your fathers), and whoever denies his father, is charged with disbelief."
Shaykh Abdul Sattar al-Hammad
Hadith Commentary: In the era of ignorance (Jahiliyyah), when people would adopt someone as a son, that son would attribute himself to the adoptive father instead of his biological father. Allah, the Exalted, has taken strict notice of this matter in Surah Al-Ahzab (: Al-Ahzab 33:5). Despite the prohibitive command, even today most people attribute an adopted child to themselves. However, this is absolutely not permitted in the Shari‘ah. Ibn Battal has written that if such fame (attribution) occurs unintentionally, it does not fall under the aforementioned warning. (: Fath al-Bari 12/67) In any case, the disbelief (kufr) mentioned here does not refer to real disbelief that expels a person from the fold of Islam; rather, what is meant is ingratitude for blessings. And Allah knows best.
Source: Hidayat al-Qari: Commentary on Sahih Bukhari, Urdu, Page: 6768