The Gospels of Mathew and John were not written by the apostles Mathew and John.
You know this because you have some arhuments tahat prove the negative, or because you pretty much believe what your interesting (and liberal) teacher tells you?
The Gospel of John was written by John. This was never disputed until the late 19th century. The motivation for the claim that John was not the author was, because of the strength of the text's claim for the divinity of Jesus. This is a Gospel with no historical doubt of authorship within the Church.
Matthew likewise authored Matthew. That is in the record. the text contains other elements from the Gospel's of Mark and Luke, but that does not detract from the fact that Matthew was known to have an author of this Gospel.