Hi,
I'm going to answer you with the obvious, because like you, I used to ask myself this question when I was younger.
The morgue is a place where bodies are stored for autopsies.
Autopsies can be ordered by the courts to find out the reason for death (suicide, murder....) or for insurance companies during a trial for road accidents.
If the bodies are naked, it's to inspect for any wounds or bruises that may be invisible to the naked eye.
For murders where rape is suspected, it's obvious that the body should be completely naked.
Clothes can also be examined in detail, so it is best to remove them from the body.