Admiral Kassem Labbuza, who heads a force charged with protecting the Balhaf port on the Gulf of Aden, was unharmed in the attack near a gas complex, the source said.
Two of his guards were killed, however, and a third wounded before the assailants identified as "Al-Qaeda members" fled the scene.
The attack occurred during a security inspection of the site.
Al-Qaeda has been blamed by the authorities for numerous attacks against energy facilities and soldiers in south Yemen, a stronghold of the extremists.