On an incredibly simplistic level, you can think of depression as occurring when your cortex thinks an abstract thought and manages to convince the rest of the brain that this is as real as a physical stressor.
Robert M. Sapolsky, Why Zebras Don't Get Ulcers
depression