Well, there are two popular theories about the origin of this phrase: One is in regards to Josephus Daniels, who was Secretary of the Navy. On the month of June, 1914, he banned all U.S. Navy ships from serving alcoholic beverages. The sailors weren't too thrilled with the decision, because they had to resort to the next strongest drink on the list, which was coffee!Since Josephus Daniels was the one responsible for banning alcohol and "forced" everyone to make the switch to coffee, the sailors nicknamed the drink after him, thus it became "a cup of joe," Joe being short for Josephus. That's the theory anyways.
However, a more plausible theory comes from Snopes, where it's explained how the word "joe" can simply mean the average man. For example, perhaps you've heard someone say: "I'm just an average joe." That means he's just an every day, ordinary kind of guy. Therefore, a drink involving the word "joe" would show that the drink is for the common man, or the average person. (http://www.knowyourphrase.com/phrase-meanings/Cup-Of-Joe.html)
There was a New York company named Martinson's Coffee (Andy Warhol liked to paint the cans) owned by a man named Joe Martinson. The neighbourhood of the company would be saturated by the aroma of roasting coffee, and coffee therefore became known as 'a cup of Joe'. (https://answers.yahoo.com/question/index?qid=20070224120839AAcoJtL)