DUBAI, United Arab Emirates — Somali pirates holding a hijacked ship off the coast of Somalia fired at a U.S. Navy helicopter as it made a surveillance flight over the vessel, the first such attack by pirates on an American military aircraft, the Navy said Thursday.