Without good maps and only passive sonar you can very well hit a mountain. Subs want to evade detection so active sensory is offline most of the time. Perhaps the situation would have merited that they don't dive as deep in uncharted territory, but subs usually only see things that make noise and mountains are quite silent.