Is it known how human sweat glands evolved?
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.