It's an ambient sound effect. Think of it as being that the dd that's about to ram you is so noisy that you can hear it without the sonar.
Why are you at periscope depth using the scope if you can hear the DD?!

You know they can spot the scope and will shoot you, right?