Why is it that we have more sweat glands in areas such as the palms of our hands and the soles of our feet? I just learned that there are more there but I am curious as to why that is.
You sweat much stronger in the palms of your hand and the soles of your feet, because they contain a much higher density of eccrine sweat glands. According to Sato et al., (see reference 1) there are something like 64 glands per cm² on your back, 108/cm² on your forearm and 600-700/cm² on the palms of your hands.
This is thought to have different reasons: First, sweating is an important way to control the body temperature. Sweat works as a defense by anti-microbial peptide dermcidin, it is also seen as am important way to maintain the conditioning of the skin and as well as a lubricant for contact surfaces. (references 2-4)
Sweating is controlled by the sympathetic (autonomic) nervous system, and can be triggered by acetylcholine and adrenaline. This explains why you get wet palms when coming into stress.
@Chris gave a nice answer, but I thought it would be better to include an answer to the 'why' part of the question. To start with, let me first say that the eccrine sweat glands on palms and soles respond to emotional stress, rather than increased body temperature 1. With that being said, the answer to the 'why' part becomes likely to get changed.
As one might know, its pretty difficult to answer the 'why did this happen during evolution?' question; there can be only theories with (usually) no conclusive proof. So, in this case too, the 'why' part remains without conclusive answer, and just theories prevail. According to the most prevailing theory, the emotional sweating causes sweaty palms that can help control the humidity of the outer layer of the skin. This could improve the friction on the skin thereby helping when you begin to sense you will be hunting an animal, fighting enemies, or about to climb a cliff (just to add, ever thought why your fingers get wrinkly after a long bath?). The generalized sweating that results from your hypothalamus then helps cool the body when these intense physical activities are happening. It also produces an odor that sends out pheromone signals to those same enemies/animals. The pheromones also could help signal potential mates that you are natural selection’s answer to their mating needs2. Again, this is just a theory and likely to have flaws, while the definitie answer is still not known. You can also have a look at the answers to this question for some more details.