It's not like they have VAT because they are in the EU. They had VAT since 1962, and they have had it at the current rate of 25% (higher than most EU countries) since 1992, which is way before the EU VAT directive was even a thing.
Edit: Correction, the EU VAT directive actually has its origins before 1992, but still after Denmark already had its own VAT.