John baptized for the forgiveness of sins, so it is not strange that he did not want to baptize Jesus. While he did not yet know Jesus as Messiah, nor had seen a sign that he was the Messiah (John 1:32–33), he knew who Jesus was, as seen in his confessing his own need of spiritual baptism by Jesus.
The baptism of John was intended for those in need of the forgiveness of sins. In light thereof it is not that strange for John to want to refuse to baptize Jesus. For us as readers of the New Testament, this does not necessarily come across as surprising, but for John who had not yet known Jesus as the Messiah nor had seen any sign that he is the Messiah (John 1:32–33), this reaction would have been completely normal. Yet he immediately recognized who he was, as is evident from the fact that he recognized his own need of spiritual baptism by Jesus1.
14 John would have prevented him, saying, “I need to be baptized by you, and do you come to me?”