The phrase originated as ‘son of a military man’ (i.e. a gun). The most commonly repeated version in this strand is that the British Navy used to allow women to live on naval ships. Any child born on board who had uncertain paternity would be listed in the ship’s log as ‘son of a gun’. While it is attestable fact that, although the Royal navy had rules against it, they did turn a blind eye to women (wives or prostitutes) joining sailors on voyages.