You are staying legally in Denmark if you have either a valid:
Passport from a visa-free country
Short-term visa (usually no more than 90 days)
Temporary Residence Permit (up to 2 or more years)
Permanent Residence Permit (time unlimited)
Citizen ship (time-unlimited passport holder)
Danish Residence Permits (opholdstilladelser) are either temporary or permanent. When you get a Residence Permit and register at the CPR Register, you receive a Residence Permit Card (opholdskort).
The residence card will be sent to your mailbox at the Danish address with which you are registered.
You must carry this card at all times while in Denmark. The card shows your identity and contains an electronic chip with your Bio-metric Features and proof that you are staying legally in Denmark.