I don't know why, but there are a lot of people where fasting works for depression.
Then there are ways of eating which seem to have an effect like low fodmaps. Etc.
anti nutrients causing inflammation(body uses nutrients to fight inflammation), leaving them out
calms the inflammation and the body can use the nutrients it has better.
Btw. supplementing zinc and magnesium seems to help ppl with depression.
Lectins(all seeds) as in beans, nuts, corn and wheat are binding to iron and zinc, I forgot what was with the magnesium, but it played a role as well...