It's not that hard to understand. An armed warship was heading back to reinforce their country at war. Thus, as an adversary, it was to be sunk at the next best opportunity.
There could be two reason of this post:
1. Young and learnt the world from video games.
2. Psyhopatic tendencies
Status of the subarine and the ship :
Submarine on periscope deep, they can use the communication mast to communicate with the ship or the other vessels.
Water temperature above 20 celsis, humans in calm water with floating aids can stay in water for days
Options for the submarine :
1. Notification shoot in front of the vessel, in a hour time kill shoot.
2. like 1, but with communication over radio and ask to abandon ship .
3. disable the ship with a torpedo by it the rudderes, ask over radio with surrender and leave the ship
4. kill as much person as possible with a single shoot, during pray, at ramadan
1-3 means the option of all crew of the ship captured, and available for POW exchange and interligence.
No need to board them on the sub, with floating aids they can stay in the water for few hours till an US merchant ship with a destroyer suprvison scoot them up.
The Central Command of USA NAVY give command for the sub CO to kill as many Iranian as possible. Have no clue why, maybe to show they have no mercy , create fear? like the Mongols as burned down half Europe ?
By your logic a pilot of an aircraft behind enemy lines could be killed on spot, because he has a weapon and there is a mathematical chance he will try to kill the capturers. And it is not easy to bring back him in a 4x4 to the base.