That's how it is used in Czech :)
Look at it as a shortening of 'Přeji ti dobrou noc. 'I wish you a good night.'
The verb 'přát něco' 'wish sth' is used with accusative. 'Dobrou' is an accusative form of 'dobrá.'
It's the accusative form. The same applies to dobrý den/dobré ráno/dobré odpoledne/dobrý večer as well. These just happen to have the same ending in accusative like they have in nominative, so you wouldn't notice it. "Noc" is the one that is different.