Why does the immune system become weaker with age in humans and in some other mammals? Let's try to be more specific than just "everything degrades with age."
We don't know.
More precisely, we know of many, many different reasons why the immune system deteriorates with age, but we don't really know which are different measures of the same thing, which are independent factors, which factors actually cause problems and which are harmless and incidental, and so on.
There are too many age-related phenomena to try to list. There's a nice recent review Aging and the immune system: An overview which spends time on
- Aging and the immune cell repertoire
- Cell Intrinsic defects in lymphocytes
- "Inflammaging" ("an overall decrease in the ability to cope with different stressors, accompanied by a progressive increase in the organism's pro-inflammatory status")
Each of these broad topics can be broken down into dozens of sub-topics, and the molecular and evolutionary mechanisms underlying each are rarely well understood.
It's a huge area of research, and it's not possible to give a single concise answer.
Here is one known factor. A key component of the immune system is the skin and the protection provided by insensible perspiration, and the antimicrobial peptides in perspiration. However as humans perform less exercise with age, the proper habituation of the eccrine sweat ducts fails. The ducts normally balance the passing electrolytes, in particular conserving sodium chloride. The antimicrobials are only effective with the correct balance of electrolytes. If the balance is not correct, normal skin bacteria are able to enter the ducts and block them. With the ducts blocked the eccrine glands force sweat under pressure into the surrounding skin, destroying capillaries, and depriving the skin of oxygen. The protective live barrier is compromised and the skin becomes wrinkly. Extreme examples of the effect can be seen, particularly on the lower legs, in aged persons where the skin has a parchment type appearance.