Why are some people with pneumonia at risk for cachexia?

Its the reverse. Cachexia is a sign of either nutritional deficiency or severe chronic underlying disease which releases inflammatory compounds that cause loss of muscle tissue and body mass. A large number of diseases do this, like cancer and advanced heart disease. This condition will lower the ability to fight infection and increase the risk of all infections including pneumonia.
Cytokines. Chemical substances released from inflammatory cells have a tendency to suppress appetite. It should not result in cachexia unless this is a very chronic and long-standing severe pneumonia. Strongly suggest looking for other reasons.