Lymph nodes are small oval structures that are part of the immune system. They normally house small immune cells called lymphocytes that aid in the bodies response to infection. There are thousands of lymph nodes throughout the body as part of the lymphatic system which has very small lymphatic ducts that allow flow between lymph nodes. There are lymphatic systems then that "drain" different parts of the body. Sometimes these lymphatic systems are relatively specific, and can give a physician clinical information about what may be going on in a particular location within the body due to the location of the lymphadenopathy (abnormal lymph node swelling).
Thus when you have an infection in one part of your body, it is typical for the lymph nodes that are part of the lymphatic system draining that part to swell because of the active immune response in that part of the body. This is why physicians are always feeling your neck for lymph nodes when you complain you may have a sore throat
, etc. However, lymph node swelling is not specific to infectious processes. When there is a cancer in one part of your body, if it starts to spread, it can potentially enter into the lymphatics and then get caught in the lymph nodes which act like filters to the spread of cancer. If you have lymph node swelling that is persistent, I would recommend making an appointment with your primary care physician
to get evaluated.