Praise be to Allaah.
According to shareeah it is not permissible for a person who adopts a child to give him his name as if he is his own son and a member of his tribe, as described in the question, because this involves lying, falsehood, the mixing of lineages and a threat to peoples honour, as well as distorting the channels of inheritance so that someone who is not entitled may receive an unfair share whilst depriving the rightful heirs of their due, and causing chaos in the sphere of relationships between mahram and non-mahram which affect issues of khulwah (being alone with a member of the opposite sex) and marriage. All of this violates sanctities and transgresses the bounds of shareeah. Hence Allaah forbade saying that a child belongs to anyone except his father or a slave belongs to anyone except his master. As Allaah said (interpretation of the meaning):
nor has He made your adopted sons your real sons. That is but your saying with your mouths. But Allâh says the truth, and He guides to the (Right) Way. Call them (adopted sons) by (the names of) their fathers, that is more just with Allâh. But if you know not their fathers (names, call them) your brothers in Faith and Mawâlîkum (your freed slaves). And there is no sin on you concerning that in which you made a mistake, except in regard to what your hearts deliberately intend. And Allâh is Ever Oft-Forgiving, Most Merciful. [al-Ahzaab 33:4-5]
The Prophet (peace and blessings of Allaah be upon him) said:
Whoever knowingly claims to belong to anyone other than his father, Paradise will be denied him. (Narrated by Ahmad, al-Bukhaari and Muslim). The Prophet (peace and blessings of Allaah be upon him) also said: Whoever claims to be the son of anyone other than his father, or the slave of anyone other than his master, on him will be the curse of Allaah continually until the Day of Resurrection.
The one who is asking this question made a mistake when he tried to do the right thing by giving his name to the child. He cannot leave matters as they are; he has to try to change it and put matters right, because of the texts that state this naming is haraam, as quoted above. As for his feeling compassion for the child, bringing him up and treating him kindly, this is a good action which is encouraged in Islam. May Allaah bless our prophet Muhammad.