Just as other ships may, submarines may also move out of a sea zone where they begin their turn with enemy ships, even destroyers. The destroyer doesn’t stop the sub’s movement, as the sub didn’t enter the sea zone - it started off there.
You either submerge or fight - not both. If you take your surprise strike, you have to suffer the return fire (unless of course your attacker is a single ship that’s neither a sub nor a battleship and you hit it).