Stock does not do that. Do you have any mods installed, such as
Fall of the Rising Sun Ultimate (FotRSU), or Bleiente's
RealModSoup, or
Trigger Maru, Overhauled (TMO)? These and other mods like them that allow for walking around a portion of the sub (the whole interior has not been modeled), all do so by clicking on the background with the left mouse button, and then using either the mouse or the arrow keys to go up, down, forward and backward. You do have to be careful what is in the background though, because you might accidentally blow the ballast tanks, or cause a crash dive if you click near the wrong thing...