Why do glands swell?

Which glands? Glands can swell because of infection or inflammation (some people refer to lymph nodes and tonsils as "glands") or because of local obstruction of their drainage (as in the salivary glands). So the best answer would depend on to which gland you are referring.
Healthy or not. Lymph glands ("nodes") draining infected areas enlarge because they are the battleground between the immune system and invaders and special immune cells are growing. If brief, it's nothing to worry about. Enlargement of an endocrine (like thyroid or adrenal) or exocrine (like salivary) is often a sign of illness.

Related Questions

Why do glands swell when sick?

Glands or immune! Glands usually refers to lymph nodes a collection of immune cells that scange bacterial and viral debris and help you form immunity against the infection. Lymph node enlargement can also occur in autimmine disease, and rarely (the ones you can see), cancer. If you have a chronic lymph nose enlargement, see your doctor. Read more...