You used to be able to drink booze on a navy ship, until Josephus “Joe” Daniels came along.
Daniels, secretary of the U.S. Navy, banned alcohol on navy ships in 1914, just before the First World War. Instead, the crew had to drink coffee, which they referred to as a “cup of Joe.”
That's why it's called a cup of Joe.