I think this would be a good example of tradition.Turn to a Bible’s table of contents and you’ll see that each of the books was written by either a prophet or apostle (Ephesians 2:20), or by someone with a direct relationship to one.
starting at the first book in the New testament, who wrote the book we call Matthew?
the Bible doesn't say.
the traditional author is Matthew the apostle.