Why is depression often related to weight gain? Is it chemical?

It's a symptom. Sometimes, folks with mood disturbances eat more and gain weight or they lose their appetite and lose weight. It is very common for a person to have a change in appetite associated with changes of their moods or even when feeling anxious or nervous. There are medical conditions, like a thyroid problem, which can mimic the signs of depression including a change of appetite and weight.