There are many possible causes for the recent tragic collisions of USS Fitzgerald and USS McCain with merchant vessels.
While this is unlikely, it is a valid question to ask, given the capabilities of US adversaries. As an example, in 2015, Russian authorities boasted that their electronic warfare prowess “makes aircraft carriers useless.”
If one or both the collisions were the result of cyber attack, it is likely the attacks were two pronged efforts with most of the focus on the merchant ships.
US Navy vessels have abundant cyber and navigational safeguards, which make them very difficult, if not impossible to spoof or misdirect. And Navy ships in high traffic waters always have a number of people on watch, both on the bridge and in the Combat Information Center (CIC), monitoring the positions of vessels nearby.
While spoofing a US Navy vessel might be ruled out, GPS navigation signals are very weak and easy to jam regardless of the receiver. In the United Kingdom, jamming trials against vessels showed that, even when the captains and crews were expecting the disruption, so many systems were affected and there were so many warning lights and alarms on the bridge, all were confused and needed a few minutes to figure out what was happening. This kind of confusion in the middle of the night in a high traffic area could temporarily distract even a sophisticated US Navy crew.
Civilian vessels, typically, are not as well equipped or manned as US Navy ships. Their navigation equipment can be easy to interfere with as was demonstrated by Professor Humphreys from the University of Texas in 2013. Merchant vessels often have only one person on watch. In the case of the motor vessel ACX Crystal which collided with USS Fitzgerald, there is some evidence that the vessel may have even been on autopilot. After the collision it immediately returned to its previous course for about 30 minutes before returning to the scene of the accident. A merchant ship’s navigation system could be interfered with to cause it to collide with another vessel.
This kind of jamming/spoofing one-two punch could create the conditions for a collision at sea, but would need to be carried out by a sophisticated actor. A number of nations around the world have the capability. Several are not friendly to the United States.