If the destroyers have never left the shipyard/naval base where they were constructed then they are technically on land and not in the ocean, so a direct attack order is not possible for a submarine to comprehend.
If you move the submarines within 5 km of the target they should notice and open fire on the target without issuing the attack order. Hold the Ctrl key and you can fine tune the location of the move command in order to do this.