The early church father Irenaeus wrote, “afterwards, John, the disciple of the Lord, who also had leaned upon His breast, did himself publish a gospel during his residence at Ephesus in Asia.” Irenaeus lived in the second century, and claimed to receive this information from John’s disciple, Polycarp.

The text seems to point to John, too. The disciple whom Jesus loved was clearly close to Peter:

Peter asks him to ask Jesus a question (John 13:24)
Peter and this disciple race to the tomb together (John 20:2-10)
Peter is fishing with this disciple when Jesus appears to them on the shore (John 21:2)
Peter swims to Jesus after this disciple identifies him (John 21:7)
After Jesus hints at Peter’s death, Peter asks about this disciple (John 21:20-24)

This close relationship supports the likelihood that this disciple was part of Jesus’ “inner circle” (Peter, James, or John). Since James is martyred early (Acts 12:1-5), and John is never mentioned by name in the whole book (which for anyone else would be a mistake), John is believed to be the most likely author.