This is from the English phrase “son of a gun.”
It was used humorously and even unironically as an interjection and as a noun in the 1970s. The contemporary American equivalent is “son of a bitch” (salamabit).
Salamagan! Na naman??
Son of a gun! Again?
Hindi ko pakikinggan ang salamagang ‘yan.
I won’t listen to that sonovubitch.
spelling variation: salumagan