In modern society, clothing are worn by humans for a number of reasons, from aesthetical like fashion to practical purposes such as to protect the body from harmful agents like harsh weather, moist, insect bites and so on. They are used even for reasons that have to do with human beings’ sense of morality.
For example, one of the reasons is covering one’s genitals, since they are considered to be private and also a bit more sensitive than the skin that covers other areas of the human body. It is unclear when humans started feeling self conscious about exhibiting their genitals in public. It may have to do with the development of monogamy, for example, since animals are mostly (save a few species) not monogamous.
As mentioned before, it is rather difficult to determine when clothing first came to be employed by humans. However, it can be inferred that the first archaic humans to ever wear clothing probably did so in order to protect themselves from the cold and maybe even rain. The first clothing accessories or garments were mostly made of animal’s skin or fur.
Clothing is the equivalent to animal fur or feathers, given that without it humans would not be able to withstand extreme cold, rain, sunburns and insect bites. At a certain point in prehistory, the bodies of preceding species of humans were also covered in fur and hair, however, and as species evolved and developed and new species began to use tools and accessories, hair became less necessary, being slowly eliminated from the human DNA.
That is basically how evolution works: species develop certain physical features needed for survival and eliminate those that are no longer necessary and it is a process that takes several thousands or millions of years.