There is no single cause of depression. Depression happens because of a combination of things including:
Genes - some types of depression tend to run in families. Genes are the "blueprints" for who we are, and we inherit them from our parents. Scientists are looking for the specific genes that may be involved in depression.
Brain chemistry and structure - when chemicals in the brain are not at the right levels, depression can occur. These chemicals, called neurotransmitters, help cells in the brain communicate with each other. By looking at pictures of the brain, scientists can also see that the structure of the brain in people who have depression looks different than in people who do not have depression. Scientists are working to figure out why these differences occur.
Environmental and psychological factors - trauma, loss of a loved one, a difficult relationship, and other stressors can trigger depression. Scientists are working to figure out why depression occurs in some people but not in others with the same or similar experiences. They are also studying why some people recover quickly from depression and others do not.
This answer is based on source information from the National Institute of Mental Health.