How did nudity come to be considered offensive or immoral instead of being perceived as a beautiful thing?

Nudity - How shocking!

As far as I know, the notion that nudity is shocking dates from about 1830.

Before then, 'fig-leaves' had often been used instead of sex organs on statues. Look at some older portraits online. You'll find that until 1820 or so women often showed quite a lot of skin. I know that's obviously not the same as being naked, but it's a pointer to attitudes.

Incidentally, already in Renaissanace times there was a widely accepted view that in religious works of art nudity should be kept to the minimum, so to speak.

For a complete lack of inhibitions about the human body, you may have to go back to Ancient Rome and Greece.

The idea that nudity is **in itself** erotic or 'naughty-naughty' is widely regarded as very philistine. Many people look rather ugly when naked and much less erotic than when clothed in fetish gear made of, say glistening PVC or of black leather.