Dispassionate scholars of the New Testament, the ones using scientific/historical methods and who have no religious axe to grind, all state flatly that none of the Gospels were written by the named individuals.
They were in fact written by professional scribes no earlier than about 50 years after Jesus’ death, and these scribes were all working from oral traditions that had been circulating for that long. John dates to almost 100 years after Jesus.
It was common practice at the time to attribute such writings to famous people, such as the original apostles.
Most people these days don’t realize that over 100 Gospels are known to scholars. Some we have complete, some partial, some only in fragments, and some by name only. People think that the four Gospels included in the New Testament were chosen as the most accurate accounts, but that’s not the case. They were chosen because they most closely adhered to the story that the evolving Christian religion wished to present.
The other Gospels were either relegated to the apocrypha, the group that sort of “couldn’t be vouched for”, or they were condemned as heresy as part of Gnosticism.
(No one in modern times knew anything of Gnosticism other than it was a heresy that had been suppressed…Until the Nag Hammurabi Library was discovered in the 40s… the so-called “Gnostic Gospels” that had been salted away in a cave.
New Testament scholar Bart Ehrman has written extensively on all this, as have other scholars such as Aileen Pagels.
Those interested might read. “Misquoting Jesus” and “Lost Christianities” by Ehrman.