A similar question was raised in another Biblical Hermeneutics posting and part of the response posted relates to this question, so I will share it here.
There are facts recorded about John that are mutually exclusive with facts that the author of the fourth gospel tells us about himself. Of course, there is no problem with scripture. Rather this problem only occurs when one tries to force the unbiblical John tradition on the text, in spite of the biblical evidence to the contrary. So the false tradition that has taught people to ignore the biblical evidence and follow after non-Bible sources who claim this unnamed author was John is the cause of the problem.
TheDiscipleWhomJesusLoved.com has a free eBook that presents the biblical evidence that can prove the beloved disciple was not John (including the mutually exclusive facts noted above) and those who care to weigh the biblical evidence on this topic may find this resource helpful as they seek the guidance of scripture when it comes to answering questions about the anonymous author of the fourth gospel.
While a comment claims John "is the only candidate that fits all the criteria" and suggests the John idea "is supported by comparison with the synoptic gospels", the Bible proves otherwise. The truth in fact is the writers of the first three gospels treat John and the unnamed "other disciple, whom Jesus loved" like different people (because they were different people). They freely mention John but never mention the beloved disciple and even omit him when he is playing a material role in the event being described.
The idea that the fourth gospel is 'John's eyewitness testimony' ignores the fact, for example, that it is the only gospel that does not mention the raising of the daughter of Jairus, the Mt. of Transfiguration, and the prayers of Jesus at Gethsemane - though John was one of only three eyewitnesses to these events. In fact, the least helpful of the four gospels, when it comes to learning about the things John witnessed, said, and did during the ministry of Jesus is the gospel which men mistakenly attributed to John.