As the other answers have already pointed out, both names refer to the same guy, and "Melkor" was dropped in favor of "Morgoth" because the former had positive connotations, while the latter is unmistakably negative in connotation.
Incidentally, the same idea applies to Sauron: He was first called Mairon, which means "The Admirable", but after he fell from grace and joined Morgoth, he was renamed Sauron, which means "Abhorred" in Qenya, and Gorthaur, which means "Terrible Dread" in Sindarin.
They are used somewhat interchangeably because they are both valid. However, more often than not, "Melkor" refers to the character before he pissed off the Elves (it was an Elf, Fëanor, who renamed him), and "Morgoth" refers to him after he pissed off the Elves.
We can see this especially clearly in the following passage from the introduction to Unfinished Tales of Númenor and Middle-earth, in which Christopher Tolkien is justifying his decision to publish stories that were, as the title implies, unfinished when his father died.
Those who would not have forgone the images of Melkor with Ungoliant looking down from the summit of Hyarmentir [upon Aman]... [or the image] of Beren lurking in wolf's shape beneath the throne of Morgoth...
- Unfinished Tales of Númenor and Middle-earth, Introduction, p. 1
The context isn't particularly important - we're only interested in the nomenclature regarding the issue of Melkor versus Morgoth. If you haven't read The Silmarillion, the key thing to take away from this is simple: The scene where Melkor and Ungoliant look down from the mountain and see Aman below them happens before Fëanor names him Morgoth. The scene in which Beren, disguised as a wolf, sneaks into his fortress and confronts him, happens after Fëanor names him Morgoth.
In this instance, as in most others, the main difference between the two names is timing. If he is being called Melkor, you're probably reading something that happened before he pissed off the Elves, and inspired Fëanor to give him a contemptuous new name. If he is being called Morgoth, you're probably reading something that happened after he pissed off the Elves, and inspired Fëanor to give him a contemptuous new name.
This is especially true of texts that purport to be written by the Elves, because they refused to call him by his original name after he annoyed them. However, it also holds up in almost every other case as well.