How were the authors of the four gospels literate? I'm curious how the authors of the four gospels (Matthew, Mark, Luke and John) actually knew how to write. They were fishermen and simple people, and very few people knew how to write back then.

Perhaps some will say that it was the Holy Spirit who gave them this ability, but I'd like to know whether there is some other historical explanation for the fact that they were literate.
I think you've cross wired your history a little bit. The lower overall literacy rate at the time doesn't mean nobody was literate. It certainly doesn't follow that a hand picked set of men must be illiterate because a lower percentage of the population was educated. Not everybody was a fisherman, ond even those that were often had other backgrounds and experiences. In fact most of the NT was written by folks with more formal education than yourself (and I say that expecting it to be true even if you turn out to have a P.h.D or something like that). Paul was about as educated as you could get at the time. And while he might have been baffled by a cell phone, it would be a mistake to assume that that his literacy was inferior to yours.

Back to the gospel authors that you asked about.


Luke was a medical doctor turned historian, not a fisherman. 'Nuf said.
John wrote John. That may sound rhetorical in a sense but while there are some strange linguistic features to the books he wrote, it would be hard to make an argument for him being illiterate based on the works he produced. Did he come from high blood and start his education early? No probably not—in fact he was likely quite young when he started with Jesus. In any event his writing shows evidence of both having been an eyewitness to Jesus like as well as being familiar with the literature of his times, the Hebrew scriptures, and of being articulate.
Matthew wasn't a fisherman either. He was a tax collector, and that meant being literate in at least two languages. Possible more. In any event his education would have been enough to get employment in a field that required a working knowledge of both his own country's laws and those of the occupying empire. 
Mark is the biggest unknown on this list and his writing suggests he might have been less well educated as some of his compatriots. His work is likely the earliest written and he seems to almost fall over his own words telling some of the stories. It's likely he didn't have a lot of upper level education. On the other hand his lack of command over the finner points of grammar are more than made up for by his first hand accounts. And yes, he was literate.


The issue of actually dealing with a pen and paper was somewhat more complex than it is now (Ever tried to write with hand made implements on hand made substrates?) and it's possible that some or all the books were dictated. While this could have helped an illiterate person get a written record of their experiences, there is no particular reason to believe that was the case with any of the NT authors. It's more likely that if anything was dictated it was more a matter of pragmatics.