It is the god or idol of the Ammonites, otherwise called Milcom, Moloch, and Melech: which in Hebrew signifies a king, and Melchom signifies their unearthly king, referring to their unholy idol, Melchom.
The Jamieson-Fausset-Brown Bible Commentary reads: The Ammonite god is said to do what they do, namely, occupy the Israelite land of Gad.
To Jehovah, the theocratic "King" of Israel, the land belonged of right; so that their Molech or Melchom was an usurper-king.
However, after they were chased from there by the Israelites, Melchom was cast down from his idolic throne.
This is the moment when Melchom was embodied as a demon after King David "took his crown".