The phrase "the disciple whom Jesus loved" in John 20:2 is the disciple beloved of Jesus used six times in the Gospel of John, but in no other New Testament accounts of Jesus. John 21:24 states that the Gospel of John is based on the written testimony of this disciple. "This is the disciple which testifieth of these things, and wrote these things: and we know that his testimony is true." (John 21.24) So we know John wrote John.

https://zondervanacademic.com/blog/who-wrote-gospels/

Papias said this about Matthew: “Matthew compiled (or ‘arranged,’ or ‘composed’) the logia (‘oracles,’ ‘sayings’ or perhaps ‘gospel’) in the Hebrew (or, ‘Aramaic’) language (or, ‘style’?), and everyone interpreted (or, ‘translated’) them as best they could.”

Matthew is hardly the most important of the disciples. He’s hardly mentioned in the entire New Testament. If the early church wasn’t sure who wrote this gospel, why would they choose someone so obscure? Matthew’s lack of prominence in the New Testament suggests to some that the early church must have had good reason to attribute the gospel to him.

For three main reasons, almost all scholars believe the Gospel of Luke was written by the same person who wrote Acts:

  • Luke and Acts were written in the same style and express the same theology
  • Both books are addressed to the same person—a man named Theophilus
  • Acts 1:1–2 appears to tie the two books to the same author

The author claims to be an eyewitness

The writer of John claims to be an eyewitness to the ministry of Jesus, and there’s good reason to believe that’s true. The gospel contains numerous details that appear incidental, some not even bearing a symbolic significance:

  • The number of water jars at the wedding in Cana (John 2:6)
  • How long the man at the Pool of Bethesda had been crippled (John 5:5)
  • The name of the servant whose ear was chopped off by Peter (John 18:10)
  • The number of fish the disciples caught at Galilee (John 21:11)

Since these details seem so unimportant, it’s hard to imagine that they would be noteworthy to a second or thirdhand writer.