Praise be to Allah.
In His holy Book, Allah instructs us not to enquire too deeply into matters that have nothing to do with our deeds and which, if the truth became plain to a person, may cause him trouble. Allah, may He be exalted, says (interpretation of the meaning):
“O you who believe! Ask not about things which, if made plain to you, may cause you trouble. But if you ask about them while the Quran is being revealed, they will be made plain to you. Allah has forgiven that, and Allah is Oft-Forgiving, Most Forbearing”
In Tafseer Ibn Katheer (3/203) it says:
Here Allah, may He be exalted, instructs His believing slaves and tells them not to ask about things for which there is no benefit for them in asking and enquiring about them, because if those matters were made plain to them, it may cause them trouble and it may be difficult for them to hear about them. End quote.
The commentators mentioned as the reason for revelation of this verse a situation that is similar to your situation that you are asking about. One of the Sahaabah was uncertain about his attribution to his father, and he wanted to find out about that by asking the Prophet (blessings and peace of Allah be upon him). But when he asked him, and the Prophet (blessings and peace of Allah be upon him) answered his question, Qur’an was revealed criticising this behaviour on the part of that questioner and rebuking him for enquiring into such matters. Al-Bukhaari (7089) and Muslim (2359) narrated that Anas (may Allah be pleased with him) said: (The people) asked the Prophet (blessings and peace of Allah be upon him) until he was hard pressed by their questioning. He ascended the minbar one day, and said: “You will not ask me anything but I will explain it to you.” I started to look to my right and my left, and every man had wrapped his head in his garment and was weeping. A man (‘Abdullah ibn Hudhaafah) who used to be slandered and attributed to someone other than his father [i.e., if he had a dispute with anyone, his opponent would attribute him to someone other than his father] stood up in the mosque and said: O Prophet of Allah, who is my father? He said: “Your father is Hudhaafah.”
Qataadah used to quote this hadeeth in reference to the verse (interpretation of the meaning): “O you who believe! Ask not about things which, if made plain to you, may cause you trouble” [al-Maa’idah 5:101].
Az-Zuhri said: The mother of ‘Abdullah ibn Hudhaafah (who was the mother of the Sahaabi who asked this question) said: I have never seen a son more disrespectful than you. How can you be sure that your mother did not commit some of the sins committed by the women of the Jaahiliyyah, thus you would have exposed her before the people?
What we advise you to do is to refrain from mentioning this matter and from wondering and asking about it. Do not ask your parents or anyone else about it. You are definitely to be attributed to your father, because you were born to his wife and the Messenger of Allah (blessings and peace of Allah be upon him) said: The child is for the (owner of the) bed (i.e. the husband). Narrated by al-Bukhaari (2053) and Muslim (1457). We ask Allah to guide you and help you to do all that is good.
And Allah knows best.