I thought the same. I assumed it was just people censoring themselves when they wanted to say son of a bitch in front a child, or anyone else who it's taboo to swear in front of.
Something about taking prostitutes on voyages across the sea in the olden days. You'd romance her under the cannons and the bastard child would be a "son of a gun". I don't remember where I learned this so feel free to correct me if I'm wrong.
Edit: I looked it up and got some details wrong, but pretty close
The phrase potentially has its origin in a Royal Navy direction that pregnant women aboard smaller naval vessels give birth in the space between the broadside guns, in order to keep the gangways and crew decks clear. Admiral William Henry Smyth wrote in his 1867 book, The Sailor's Word-Book: "Son of a gun, an epithet conveying contempt in a slight degree, and originally applied to boys born afloat, when women were permitted to accompany their husbands to sea; one admiral declared he literally was thus cradled, under the breast of a gun-carriage."
I've heard an old man use it this way a long time ago in the west. You would only hear it from someone who's very old or thinks they're a polite cowboy.
Fun fact: The Navy uses the affirmative "aye" or "aye aye" as opposed to "roger" like the Army/Air Force/etc because of similar slang origins. Basically, sailors used to use the word "roger" to mean "fuck," both as an insult and as a way to identify women they had been with while in port.
"Yeah, I rogered her last night at the tavern," kind of thing. But as sailors began to respond to officers using "Roger that (fuck that)," the Navy came down and made "aye aye" the official affirmative response for their personnel.
And even then, "aye" is simply a "I understand" whereas "aye aye," means "I understand and will carry out X."
The US Navy also launched an investigative unit during the 1800s (I wanna say the 1880s?) to find homosexual sailors and kick them out of the Navy. The unit only lasted a couple of years before being shut down, as the only people volunteering for the unit were homosexual sailors. 😆
We had a similar situation at a hospital IT department I worked in about 10 years ago. We had been given a grant for Computers on portable platforms so Nurses could take the computer with them and update records as they needed live and during the moment. The acronym they came up with to describe them was COW aka Computers On Wheels. Someone got insulted about this and I am thinking it was because this hospital is in a dairy farming area and some poor farmers daughter got hurt by it somehow?? So the IT department was told to called them WOW from that day on aka Workstations on Wheels. So trivial but yet so controversial and time wasted was the biggest issue for us as we had to go around and pull the names off and put all new labels on them for inventory. So instead of COW-01 and so forth ,it was WOW-01 and so on.