The Korean orthography is not always coincident with its pronunciation.
The transformation from 고맙습니다 to 고맙슴니다 is called 자음동화(consonant assimilation).
The rule is
받침ㄱ, ㄷ, ㅂ + 초성 ㄴ, ㅁ → 받침ㅇ, ㄴ, ㅁ + 초성 ㄴ, ㅁ
ex)
어두육미 → 어두융미, 맏누이 → 만누이, 법망 → 범망, 고객님 → 고갱님