Let's say Y is a boy. His parents are not married. His father left his mother as soon as she gave birth to Y. Then Y's mother was punished for committing adultery and she repented to Allah and married a man. Can Y introduce his mom's husband as his dad? If not then what will he tell people if they ask about their father? According to Islam, you are not allowed to tell you are son of someone who isn't your father.
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 or appear to the child as his father because this is falsehood and lead to many problems such as:
This involves lying, falsehood, the mixing of lineages and a threat to peoples honor.
It distorts the channels of inheritance so that someone who is not entitled may receive an unfair share whilst depriving the rightful heirs of their due.
Causes 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 shariah. This is why 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.