https://en.wikipedia.org/wiki/Submarine_navigation
"On the surface or at periscope depth, submarines have used these methods to fix their position"...GPS being one of them.
A submarine can also navigate by the stars without surfacing.
https://www.usni.org/magazines/proceedings/2021/october/navi...
"This is precisely the information required by the traditional method of celestial navigation, and it is accomplished without the need to surface or use a sextant!"
Also, look up the HN guidelines on debating your downvotes.
Welcome to HN!