An actual submarine didn't truly exist until the USS NAUTILUS with the advent of nuclear propulsion, allowing it to stay submerged for extended periods of time. Basically the only limiting factor was onboard supplies for the crew (and of course the mental strain of being underwater in confined spaces for weeks on end). Before that, the correct term was submersible because the the boat could only stay down for as long as the batteries and/or oxygen lasted and needed to surface so the diesel engines could be used for propulsion, recharging the batteries and exchanging the air supply.
The German's had some designs during the later part of WWII that had huge batteries and sleek hull designs that could power the boat for long stretches of time (and even some other experimental power sources) but eventually they would need to use snorkels to draw in air so the diesels could be run while being close to the surface. These German U-Boat designs were the basis for the Cold War U.S. Navy's GUPPY program and provided a big leap forward in sub design.
The first submersibles developed were small and called boats because they were, at times, carried on the decks of ships. So technically, the first submersibles were actually boats because of their small displacement and the fact that they weren't true underwater crafts. Over time, the designs changed and the displacement increased considerably to the point where, technically, they shouldn't really be classified as boats, but seeing that navies are fanatically traditional, the term stuck and is still used today.