Chances are this is not a serious condition, and here's why: Lymph nodes in the armpits are often "reactive" and enlarge as they work to drain infection from the arms or upper chest. If your lymph nodes are painful or tender to the touch, this is usually a good sign that they are just doing their job. And while enlarged lymph nodes can be a sign of a malignancy such as lymphoma, in that case the nodes would be harder and "matted" (nonmobile) and they would not hurt when touched. The fact that your lymph nodes recede and stop hurting suggests that they are reactive and not malignant, as malignant nodes do not disappear or go down significantly over time.
So what causes reactivity? Viruses, for one thing, as well as your menstrual cycle, since there is often breast tissue in the armpit area and that tissue responds to hormones as they cycle. In addition, cuts on your fingers, nicks in your cuticles from a manicure, or a simple scrape on your hand can cause your lymph nodes to enlarge as your body fights off infection. Finally, and most commonly, shaving your armpits can cause your lymph nodes to change because hair follicles can become clogged and slightly inflamed.