If human descends from apes than probably we lost our hair. Perhaps in the age of homo erectus we lost our hairs and began transpiring through our skin with sweat glands. But how did these glands evolve? Is it from another kind of cell which is similar?
I am not sure exactly what you are after when asking "how did these glands came?". It seems that you wrongly believe that similar glands do not exist in other primates. Here is a short answer that will help you to search for more information about the evolution of these glands.
Chimpanzees and Gorilla also have sweat glands. The use of sweat gland in thermoregulation is however quite unique to humans and is thought to have evolved in parallel of hair loss and bipedism. See The evolution of sweat glands (Fold and Semken 1991) for more information.
if humans descends from apes then ...by
knowing that humans descend from apes ...or even better,
Knowing that humans are apes .... $\endgroup$