The answer that many members have given that Ishmael was illegitimate son of Abraham is based on ignorance of knowledge.
Those who believe Jewish writings of course they will always remain ignorant. Because Jews always lied and changed the God’s words in Torah They killed many of the Prophets God sent to guide them. Sending Jesus Christ was their last test from God and they failed by trying to have Jesus crucified. God had Jesus Christ lifted alive to Heaven by his Angels.
Prophets never commited sins. Just like if a Layer commits a crime, Judge gives him harder punishment than ordinary people, sameway God would punish a Prophet much more severely if he commits sin knowing fornication a sin. Abraham married to Hagar. After marriage she became mother of Ishmael and Abraham. Ishmael was Abraham’s firstborn son. God showed Abraham in dream that he was sacrificing his son Ishmael. So he told Ishmael and Ishmael replied to father; go ahead and do God has commanded you! you will find me patient.
Jews invented similar story of Ishaq being the only son. Or Ishmael’s nation will look better than their’s,
When Abraham was sacrificing Ishmael, Angel Gabriel came and stopped him and said God has accepted your sacrifice, and sends you this Lamb instead. Abraham and Ishmael together built the Kaaba and Muslims started coming every year for Haj. Muslims walk seven times anti clock wise around Kaaba and also sacrifice animals on the 9th day of lunar month known as month of Zul-Haj.
Read some of the God's words translated by a Scholar of Islam now for your knowledge.
Of the Jews there are those who displace words from their (right) places, and say: "We hear and we disobey"; and "Hear what is not Heard"; and "Ra'ina"; with a twist of their tongues and a slander to Faith. If only they had said: "What hear and we obey"; and "Do hear"; and "Do look at us"; it would have been better for them, and more proper; but Allah hath cursed them for their Unbelief; and but few of them will believe.
( سورة النساء , An-Nisa, Chapter #4, Verse #46)
But the transgressors among them changed the word from that which had been given them so we sent on them a plague from heaven. For that they repeatedly transgressed.
( سورة الأعراف , Al-Araf, Chapter #7, Verse #162)
The Jews say: "(Allah)'s hand is tied up." Be their hands tied up and be they accursed for the (blasphemy) they utter. Nay, both His hands are widely outstretched: He giveth and spendeth (of His bounty) as He pleaseth. But the revelation that cometh to thee from Allah increaseth in most of them their obstinate rebellion and blasphemy. Amongst them we have placed enmity and hatred till the Day of Judgment. Every time they kindle the fire of war, Allah doth extinguish it; but they (ever) strive to do mischief on earth. And Allah loveth not those who do mischief.
( سورة المائدة , Al-Maeda, Chapter #5, Verse #64)
It was We who revealed the law (to Moses): therein was guidance and light. By its standard have been judged the Jews, by the prophets who bowed (as in Islam) to Allah’s will, by the rabbis and the doctors of law: for to them was entrusted the protection of Allah’s book, and they were witnesses thereto: therefore fear not men, but fear me, and sell not my signs for a miserable price. If any do fail to judge by (the light of) what Allah hath revealed, they are (no better than) Unbelievers.
( سورة المائدة , Al-Maeda, Chapter #5, Verse #44)
Say: "We believe in Allah, and in what has been revealed to us and what was revealed to Abraham, Isma'il, Isaac, Jacob, and the Tribes, and in (the Books) given to Moses, Jesus, and the Prophets, from their Lord: We make no distinction between one and another among them, and to Allah do we bow our will (in Islam)."
( سورة آل عمران , Aal-e-Imran, Chapter #3, Verse #84)
The Jews call 'Uzair a son of Allah, and the Christians call Christ the son of Allah. That is a saying from their mouth; (in this) they but imitate what the unbelievers of old used to say. Allah.s curse be on them: how they are deluded away from the Truth!
( سورة التوبة , At-Taubah, Chapter #9, Verse #30)
Allah hath heard the taunt of those who say: "Truly, Allah is indigent and we are rich!"- We shall certainly record their word and (their act) of slaying the Prophets in defiance of right, and We shall say: "Taste ye the penalty of the Scorching Fire!
That they said (in boast), "We killed Christ Jesus the son of Mary, the Messenger of Allah.;- but they killed him not, nor crucified him, but so it was made to appear to them, and those who differ therein are full of doubts, with no (certain) knowledge, but only conjecture to follow, for of a surety they killed him not:-
( سورة النساء , An-Nisa, Chapter #4, Verse #157)
Christ the son of Mary was no more than an apostle; many were the apostles that passed away before him. His mother was a woman of truth. They had both to eat their (daily) food. See how Allah doth make His signs clear to them; yet see in what ways they are deluded away from the truth!
( سورة المائدة , Al-Maeda, Chapter #5, Verse #75)
Mocked were (many) apostle before thee; But their scoffers were hemmed in by the thing that they mocked.
Muhammad is not the father of any of your men, but (he is) the Messenger of Allah, and the Seal of the Prophets: and Allah has full knowledge of all things.
( سورة الأحزاب , Al-Ahzab, Chapter #33, Verse #40)
(Both) the Jews and the Christians say: "We are sons of Allah, and his beloved." Say: "Why then doth He punish you for your sins? Nay, ye are but men,- of the men he hath created: He forgiveth whom He pleaseth, and He punisheth whom He pleaseth: and to Allah belongeth the dominion of the heavens and the earth, and all that is between: and unto Him is the final goal (of all)"
( سورة المائدة , Al-Maeda, Chapter #5, Verse #18)