The Fourth Gospel, like the three Synoptics (Matthew, Mark and Luke) is anonymous - the original Greek does not record the author of the text. As far as historical scholarship can ascertain, the title "...According to John" was added a number of decades following its publication when it was joined and circulated with the three Synoptics as the "fourfold gospel", in order to distinguish it from each of the others.
As far as external evidence is concerned, from those in the early history of Christianity, only the most extreme (such as the Alogoi - "witless ones") denied that the Apostle John (son of Zebedee) wrote the fourth gospel. Polycarp (70-156 AD), who knew John son of Zebedee personally; Papias, a contemporary of Polycarp who may also have been a disciple of John; Clement of Alexandria, Tertullian and Irenaeus (all 2nd Century), each provide witness to the Apostle John being the author of the Fourth Gospel (see Eusebius, Ecclesiastical History 3.36, 5.20.5-6, 6.14.7; and Irenaeus, Against Heresies, 2.1.2). Thus the external evidence, while not contemporary to the writing of the gospel itself, is still very impressive.
The internal evidence is that which is most often disputed in modern scholarship. Within the text itself, the author seems to refer to himself (21:20-25) as "the beloved disciple" (although this understanding is contested), and does so throughout the gospel (13:23, 19:26-27, 20:2-9, 21:20-25), but determining to whom this refers can be tricky, and the conclusion is often disputed.
The "beloved disciple" is clearly represented as an eyewitness - he is found at the last supper (13:23), at the cross (19:26-27) and at the empty tomb (20:1-9). Now the fact that he is found at the last supper means that he is one of the twelve, as the Synoptics are clear that only Jesus and the twelve were present (Matt. 26:20). Within the gospel, the "beloved disciple" is frequently distinguished from Peter (13:23-24, 20:2-9, 21:20), and the other disciples mentioned during the account of the last supper and distinguished from the "beloved disciple" (Judas Iscariot [13:26], Simon Peter [13:23-24], Thomas [14:5], Philip [14:8], Judas - not Judas Iscariot [14:22]). Again, the "beloved disciple" is by implication included in the group of seven disciples who go fishing in chapter 21, but is distinguished from Peter, Thomas and Nathanael, leaving the possibilities of James or John, sons of Zebedee, or one of the two other (unnamed) disciples who were all fishing together. James, the son of Zebedee was the first of the apostolic band to be martyred (probably around 41-44 AD) and thus could not be the author since the "beloved" disciple lived long enough to give weight to the belief that he would not die (21:23). Thus we are left with the possibility that the "beloved disciple" is either John, son of Zebedee, or one of the two unnamed disciples mentioned in 21:2.
To now focus on any one of these possibilities must fall to assumptions and implications. From other accounts (Mark 5:37, 9:2, 14:33; Acts 3:1-4:23, 8:15-25; Gal. 2:9) of the period we see John, son of Zebedee frequently associated with Peter as a good friend, just as the "beloved disciple" seems to be in the fourth gospel (13:23-24, 20:2-9, 21:20-25). It is also interesting to note that John the Baptist is not distinguished from any other Johns by the author, and it stands to reason that only an author by the name of John would not feel the need for the qualification: "the Baptist". Finally, neither James nor John (sons of Zebedee) are mentioned by name throughout this gospel while the author (who is clearly an apostle, but not James [see above]) insists on refraining from the use of his own personal name, therefore again implying John.
Therefore, we can fairly safely assume John, son of Zebedee to be the "beloved disciple", and assuming the "beloved disciple" wrote the fourth gospel (as is clearly implied in 21:20-25), we can conclude that the Apostle John, son of Zebedee, wrote the fourth gospel, based on both implied internal conclusions and very strong external considerations.
Arguments against this will often center on the likelihood of a Christian referring to himself in such a way as "the beloved disciple", implying some sort of exclusivism; or by asking why he would not use his personal name. The traditional answer to both of these questions, which also seems the easiest to understand, is that John didn't need to call himself an apostle - there was no need to draw attention to himself by using his name and title, and so didn't: he chose a name which numbered him among all believers - "one whom Jesus loved". And this was meant to draw attention to the fact that Jesus loved him mercifully, as if there were no other way for one as holy as the Christ to relate to one as sinful as the subject of of his love. If that is considered to be an unsatisfactory answer, it is interesting to note that this answer is more plausible than the other possibility, for if the author were referring to another disciple as "the one whom Jesus loved," he would then be implying that Jesus loved certain disciples and not others; or one above the rest.
Probably 80-85 AD, although this is a very tentative suggestion.
