What you probably call a sub is actually an Italian sandwich called hoagie. You may also know it as a hero or grinder sandwich. All these names are American that was invented in the US by the Italians.
The origin of the name “sub” or “submarine” is somewhat obvious. Because the sandwich is long, kind of like a submarine.
The name hoagie is a little more interesting and scattered. One version, is during World I, a shipyard in Philly called Hog Island put lettuce and meat in a sandwich which is the hoagie. Another version is, street vendors of “hokey pokey” men put this sandwich together and the name was derived. The third version is that it was a sandwich put together by the for the destitute or “hokie”.
No matter what the version, we know the sandwich originated in Philadelphia.