You can greet somebody in different ways, really. Dutch is a very dynamic language. The most used: Goedendag! Goeie dag! Hallo! Dag Pieter ! Sometimes they pronounce the N, sometimes they say it with "je" (goeIEdag). They can say "hallo-o!!", "Hey" or "Hi!". The most classic and stylistic ones are "goedendag/goeiedag/hallo". Dutch speaker here.
If you would want to literally say: "Have a good day" that would be "Heb een goede dag". That's right, there's no n.
But look at the German translation: "Haben Sie einen guten Tag". The n is a result of Akkusativ Case in the sentence. You have who/what? The day (Den Tag).
I think it's just a proto-German leftover. That's why there is no n in Goedenacht and why we have flowers like 's avonds, Den Haag etc.