This is a famous...okay, let's call it "famous"...incongruity. In my opinion, the fundamental problem isn't anachronism, as there is at least a little ambiguity about when the name "Moria" came into being. For instance, it's used to describe Khazad-dum in the Second and early Third Age in Appendix A.III and in the Tale of Years. And there's this note in Appendix F.II:
But Moria is an Elvish name, and given without love; for the Eldar, though they might at need, in their bitter wars with the Dark Power and his servants, contrive fortresses underground, were not dwellers in such places of choice. They were lovers of the green earth and the lights of heaven; and Moria in their tongue means the Black Chasm.
But that highlights the other issue: an Elf, a supposed friend to Dwarves, etching "The Black Chasm", a name "given without love" on the Durin's own Door seems a serious gaffe, does it not?
The internal explanation I like best is that "Moria" is some sort of corruption in the text possibly just the illustration. For instance, a more polite name was on the door, Gandalf or a later translator of the Red Book changed this to the familiar "Moria" for the convenience of the Fellowship or later readers, and the illustrator followed suit without noticing the oddity.
Thinking on this right now, the variation on this that really floats my boat is to imagine that the corruption was introduced in the Door of Durin drawing by the fictional author and illustrator J.R.R. Tolkien, i.e., the imaginary character who the real Tolkien feigns is presenting us with a rediscovered history. I like this especially in light of the later incongruities on Balin's tomb inscription.