Short answer
Jesus came as a servant of God (﷾), and servants of God (﷾) turn to Him in humility. John preached a baptism of repentance for the forgiveness of sins, and Jesus came to be baptised by him. The Gospels struggle to explain this. In Matthew, John tries to refuse, and Jesus says only that it is fitting "to fulfil all righteousness". Luke tells of John's arrest first, and does not say who baptised Jesus. John's Gospel leaves the baptism out. Historians agree that the baptism really happened. Later, from prison, John even sent to ask Jesus, "Art thou he that should come?" Islam's answer is simple. The Qur'an calls both men prophets of Allah (﷾), and prophets turn to Him.
Full explanation
Why Christians say he was baptised
Christians hold that Jesus was without sin, as the letter to the Hebrews says. They read his answer in Matthew, that it was fitting to fulfil all righteousness, in two ways. They take it as obedience to God's (﷾) plan. They also take it as Jesus standing with the sinners he came to save.
“For we have not an high priest which cannot be touched with the feeling of our infirmities; but was in all points tempted like as we are, yet without sin.”
“Then cometh Jesus from Galilee to Jordan unto John, to be baptized of him. But John forbad him, saying, I have need to be baptized of thee, and comest thou to me? And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him.”
A baptism of repentance
John the Baptist was a Jewish preacher of the first century. He baptised people in the River Jordan, washing them in water as a sign of turning back to God (﷾). Mark, the earliest Gospel, calls this a baptism of repentance for the remission (forgiveness) of sins. In Matthew John says he baptises unto repentance. Paul, a Christian missionary of the first century, describes it the same way in Acts. Mark then states plainly that Jesus was baptised by John in the Jordan.
“John did baptize in the wilderness, and preach the baptism of repentance for the remission of sins.”
“I indeed baptize you with water unto repentance: but he that cometh after me is mightier than I, whose shoes I am not worthy to bear: he shall baptize you with the Holy Ghost, and with fire:”
“And he said unto them, Unto what then were ye baptized? And they said, Unto John’s baptism. Then said Paul, John verily baptized with the baptism of repentance, saying unto the people, that they should believe on him which should come after him, that is, on Christ Jesus.”
“And it came to pass in those days, that Jesus came from Nazareth of Galilee, and was baptized of John in Jordan.”
How each Gospel handles it
Mark tells the baptism in one plain sentence. Only Matthew has John's protest and Jesus' short reply, which says it is fitting but not why. Luke says he writes in order. Yet he reports John shut up in prison first, and only then says Jesus was baptised, without naming who baptised him. John's Gospel never narrates the baptism at all. Historians agree that the baptism happened. Each later Gospel is more uneasy with it than the one before.
“Then cometh Jesus from Galilee to Jordan unto John, to be baptized of him. But John forbad him, saying, I have need to be baptized of thee, and comest thou to me? And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him.”
“Forasmuch as many have taken in hand to set forth in order a declaration of those things which are most surely believed among us, Even as they delivered them unto us, which from the beginning were eyewitnesses, and ministers of the word; It seemed good to me also, having had perfect understanding of all things from the very first, to write unto thee in order, most excellent Theophilus,”
“Added yet this above all, that he shut up John in prison. Now when all the people were baptized, it came to pass, that Jesus also being baptized, and praying, the heaven was opened,”
Uses Jesus' baptism by John as a leading example of the criterion of embarrassment: the early church would hardly have invented an event in which Jesus submits to John's baptism of repentance, and the Gospels show unease with it, for example in the exchange Matthew adds between John and Jesus.
What John knew, and what he asked
Luke says the unborn John leapt for joy in his mother's womb when Mary greeted her. John's Gospel has him call Jesus the Lamb of God and bear witness that he is the Son of God. Yet later, from prison, John sends two disciples to ask Jesus whether he is the one to come, or whether they should look for another. So John's Gospel has John bearing witness that Jesus is the Son of God, while Luke has him still asking. The two accounts do not fit together. In Matthew, John knows Jesus before the baptism and protests. In John's Gospel he says, 'I knew him not,' until he saw the Spirit descend. And John himself never left his own work to follow Jesus.
“For, lo, as soon as the voice of thy salutation sounded in mine ears, the babe leaped in my womb for joy.”
“The next day John seeth Jesus coming unto him, and saith, Behold the Lamb of God, which taketh away the sin of the world.”
“And I saw, and bare record that this is the Son of God.”
“And John calling unto him two of his disciples sent them to Jesus, saying, Art thou he that should come? or look we for another?”
“Now when John had heard in the prison the works of Christ, he sent two of his disciples, And said unto him, Art thou he that should come, or do we look for another?”
“And I knew him not: but that he should be made manifest to Israel, therefore am I come baptizing with water. And John bare record, saying, I saw the Spirit descending from heaven like a dove, and it abode upon him. And I knew him not: but he that sent me to baptize with water, the same said unto me, Upon whom thou shalt see the Spirit descending, and remaining on him, the same is he which baptizeth with the Holy Ghost.”
“Then cometh Jesus from Galilee to Jordan unto John, to be baptized of him. But John forbad him, saying, I have need to be baptized of thee, and comest thou to me? And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him.”
John's disciples kept their own way
The Gospels themselves show that John's disciples stayed a separate group while Jesus preached. They kept their own fasts, and they buried John. Two of them followed Jesus, John's Gospel says, but many did not. Years later Paul met disciples at Ephesus, a city in what is now Turkey, who knew only John's baptism. An early Christian work records that some of John's disciples even proclaimed John as the Christ, the promised Messiah.
“And the disciples of John and of the Pharisees used to fast: and they come and say unto him, Why do the disciples of John and of the Pharisees fast, but thy disciples fast not?”
“And his disciples came, and took up the body, and buried it, and went and told Jesus.”
“And the two disciples heard him speak, and they followed Jesus.”
“And he said unto them, Unto what then were ye baptized? And they said, Unto John’s baptism. Then said Paul, John verily baptized with the baptism of repentance, saying unto the people, that they should believe on him which should come after him, that is, on Christ Jesus.”
This early Christian work, which survives in a Latin translation, records that some of John the Baptist's disciples separated themselves and proclaimed their own master as the Christ, and that one of them argued that John, not Jesus, was the Christ.
"None good but one, that is, God"
The baptism is not the only place where Jesus sets himself below God (﷾). When a man called him good, Jesus asked why he called him good, since none is good but God (﷾). Mark and Luke both record it.
“And Jesus said unto him, Why callest thou me good? there is none good but one, that is, God.”
“And Jesus said unto him, Why callest thou me good? none is good, save one, that is, God.”
A servant who turns to his Lord
In the Qur'an Jesus says he is a servant of Allah (﷾), commanded to pray and give charity as long as he lives. John, called Yahya, is a prophet who confirms a Word from Allah (﷾). In Islam, turning to God (﷾) in repentance is worship. The best of people do it most. The Prophet (ﷺ) said he asked Allah's (﷾) forgiveness more than seventy times a day. A prophet who comes to a baptism of repentance is acting as a servant, not as God.
“He said: "I am indeed a servant of Allah: He hath given me revelation and made me a prophet;”
“"And He hath made me blessed wheresoever I be, and hath enjoined on me Prayer and Charity as long as I live;”
“While he was standing in prayer in the chamber, the angels called unto him: "Allah doth give thee glad tidings of Yahya, witnessing the truth of a Word from Allah, and (be besides) noble, chaste, and a prophet,- of the (goodly) company of the righteous."”
Abu Huraira reports that he heard the Prophet (ﷺ) swear by Allah that he asked Allah's forgiveness and turned to Him in repentance more than seventy times a day.
Verse by verse
Matthew 3:13-15 — Gospel of Matthew, chapter 3, verses 13-15
“Then cometh Jesus from Galilee to Jordan unto John, to be baptized of him. But John forbad him, saying, I have need to be baptized of thee, and comest thou to me? And Jesus answering said unto him, Suffer it to be so now: for thus it becometh us to fulfil all righteousness. Then he suffered him.”
Cited for
Jesus had no sin to repent of. He was baptised "to fulfil all righteousness": to obey God's plan and to stand with sinners.
The response
The phrase says the baptism was fitting, not why a sinless God (﷾) should receive a baptism unto repentance. Mark gives no reason at all, and John's Gospel does not tell the baptism. And the same Jesus asked why he was called good, since none is good but God (﷾).
Where it lands — No Gospel gives a reason that fits a sinless God (﷾). The event fits a devout servant of God (﷾).
John 1:29 — Gospel of John, chapter 1, verse 29
“The next day John seeth Jesus coming unto him, and saith, Behold the Lamb of God, which taketh away the sin of the world.”
Cited for
John recognised Jesus as the Lamb of God and the Son of God, so the baptism shows John's lesser place, not any need in Jesus.
The response
John, later in prison (Matthew 11:2), sends to ask Jesus whether he is the one to come or whether they should look for another. John's own disciples also went on as a separate group, fasting on their own and burying their master. And the Gospels do not agree on when John knew him. In Matthew, John knows Jesus before the baptism. In John's Gospel he says, 'I knew him not,' until he saw the Spirit descend.
Where it lands — John's question from prison, and his disciples' separate path, do not fit a John who knew Jesus as the Son of God. In the Qur'an, John confirms Jesus as a Word from Allah (﷾): a prophet, not God.
Perspectives
Mainstream Christian
Jesus was sinless and had nothing to repent of. He was baptised to fulfil all righteousness, to identify with sinners, and to be revealed as the Son of God.
Hebrews says Jesus was tempted in all points as we are, yet without sin.
Rebuttal
Islam agrees that Jesus was pure: the Qur'an calls him "a holy son". Yet Mark calls John's baptism one of repentance for the forgiveness of sins. And Hebrews does not say why Jesus came to it. In Islam, turning to God (﷾) in repentance is worship, and the best of people do it most.
Christians read "to fulfil all righteousness" as Jesus obeying God's plan and standing with sinners, not as repenting.
Rebuttal
The phrase says the baptism was fitting. It does not say why Jesus, if he were God and without sin, would receive a baptism of repentance. Mark gives no reason, and John's Gospel does not tell of the baptism. And the same Jesus asked a man why he called him good, since none is good but God (﷾).
Historians
That John baptised Jesus is one of the best attested facts about Jesus. The later Gospels grow more uneasy with it.
Jesus was baptised by John, whose baptism was one of repentance for the remission of sins.
The later Gospels soften the scene. Only Matthew has John's protest. Luke tells of John's imprisonment first. And John's Gospel never tells of the baptism at all.
John's disciples stayed a separate group while Jesus preached. Some twenty years later, Paul met disciples at Ephesus who knew only John's baptism.
The Islamic perspective
Jesus and John were both prophets and servants of Allah (﷾). A baptism of repentance fits a humble servant of God (﷾). The Gospels' efforts to explain it away show that they were already making Jesus more than he was.
Jesus came to a baptism of repentance. The Gospels give no reason for it that fits the belief that he was God and without sin.
When a man called him good, Jesus asked why, since none is good but God (﷾).
John is said to have known that Jesus was the Son of God. Yet later he sent word from prison to ask whether Jesus was the one who was to come.
The Qur'an calls Jesus a servant of Allah (﷾), who was commanded to pray. And it calls John a prophet who confirmed a Word from Allah (﷾).
The Prophet (ﷺ) asked Allah (﷾) for forgiveness more than seventy times a day. In Islam, turning to God (﷾) in repentance is worship.