My favorite just-so story about the roots of depression is that it emerged during the last glacial period as a response to extreme cold weather. It's a behavioral adaptation that would have made it easier for humans to remain indoors for long periods of time without going crazy/killing each other.