At the beginning of the movie, one of the German officers explains the abilities of the sub: it can stay submerged for a very long time. As long as it's submerged, detection of the sub is difficult. So why do they stay on the surface almost all the time?
The submarines of this eras ability to stay under water for longer periods of time was very limited compared to what it is today. The subs would stay on the surface while cruising unless they detected other vessels in the vicinity where after they would submerge the sub.