I am a Moroccan citizen, I was in USA as tourist, and I plan to go back to Morocco through Norwegian airways, I have a layover for three hours in Copenhagen, do I need a visa??
Specifically for Copenhagen, you don't have to go through immigration when transferring between two non-Schengen flights -- all the gates currently used for non-Schengen flights are behind the same passport control line.
There are a few shops in the extra-Schengen area but waiting there for three hours is not going to be the high point of your journey.
Check with your airline to see if they require you to have a visa before they'll let you board the flight to Copenhagen. If you have an onward ticket with the same airline this seems unlikely but it doesn't hurt to be sure.
Also be sure that your ticket offers through check-in of your baggage -- Norwegian's website says they don't offer this for all connections and/or ticket classes. If you need to collect and re-check your bags in Copenhagen you will need to go through immigration.