Despite the traditional ascriptions all four are anonymous, and none were written by eyewitnesses. [Wikipedia]
Doesn't John's gospel explicitly state that it was written by the disciple John?
No, the book of John does not explicitly state that it was written by the disciple John. However, there is a worthy discussion to be had about the combination of external and internal evidence that make this a reasonable conclusion. The internal evidence alone does tell you that it was written by an eyewitness and, when combined with Mark, an apostle. I will be following D.A. Carson's discussion of authorship on John in his Introduction to the New Testament. I have scanned the relevant section from his book and put it in dropbox for your viewing, which can be accessed here. This is not an amazing scan, and it contains my underlinings and scribbles, but I did convert it to a (mostly) searchable pdf so a good portion can be copy and pasted.
The fourth gospel does not explicitly assert its author’s name: like the Synoptics, it is formally anonymous. As far as we can prove, the title “According to John was attached to it as soon as the four canonical gospels began to circulate together as “the fourfold gospel.” In part, no doubt, this was to distinguish it from the rest of the collection; but it may have served as the title from the beginning (see chapter 3 on Matthew). (p. 229)
F. F. Bruce observes:
“It is noteworthy that, while the four canonical gospels could afford to be published anonymously, the apocryphal gospels which began to appear from the mid-second century onwards claimed (falsely) to be written by apostles or other persons associated with the Lord.” (The Gospel of John, cited in Carson).
The book of John does, however, claim to be written by an eyewitness:
John 21:24 “This is the disciple who is bearing witness about these things, and who has written these things, and we know that his testimony is true.”
Read John 21:20-23 to find out who “this” is. It is the disciple that was rumored to not die.
That being said, what evidence is there that this book was, in fact, written by the apostle John?
Irenaeus (disciple of Polycarp who was a disciple of John) specifically claims John wrote the Gospel. “John the disciple of the Lord, who leaned back on his breast, published the gospel while he was resident at Ephesus in Asia” (Adv. Haer. 3.1.1).
Eusebius reports that Clement wrote, “But that John, last of all, conscious that the outward facts had been set forth in the Gospels, was urged on by his disciples, and, divinely moved by the Spirit, composed a spiritual Gospel.” (H.E. 6.14.7)
Quotations from John as an authoritative source:
Irenaeus reports Polycarp discussing his conversations “with John and with others who had seen the Lord…and how Polycarp had received them from the eyewitnesses of the word of life…”
Polycarp was “entrusted with the oversight of the Church in Smyrna by those who were eye-witnesses and ministers of the Lord” reports Irenaeus (H.E. 3.36). He is typically referred to as a disciple of John.
An important consideration in discussion early church testimony surrounding authorship of John's Gospel, 1-3 John, and Revelation is the issue of there being two potentially different or potentially identical Johns in discussion, John the elder or John the apostle. To summarize, there is some confusion about which John is in reference between Papias and Eusebius’ writings, whether it is John the elder (see 2 John 1, 3 John 1) or John the apostle, or whether or not those are two different people. Some of Papias’ words (such as those on Matthew’s Gospel) have caused lots of confusion, even over just the translation. I won’t go into that here.
There is more evidence and complications that I don’t have time to enumerate because I’m studying for finals. I encourage you to read the linked document to look at these. The disciple whom Jesus loved is used 6 times John 13:23, 19:26, 20:2, 21:7, 21:20. Wikipedia has some discussion on who this disciple is. Further discussion can show that this disciple was a son of Zebedee.
The full discussion in Carson's Introduction (my scanned version) can again be found here. This introduction has by far the most thorough evaluation of authorship on the NT documents (especially the Gospels) that I have seen, and it defends traditional authorship.