All humans were built with the "fight or flight" response and our ancestors were no different. Like everyone, our ancestors experienced anxiety and likely bouts of depression; the issue is that generalized anxiety disorder as well as well as depression has and continues to rise at an alarming rate. Generally speaking, our ancestor did experience anxiety and depression, but not to the disordered extent that many people do today. What was once a necessary and built in mechanism to protect us from danger has become a constant for some people.

Anxiety disorder wasn't even diagnosed until 1980, not so long ago in the scope of medical diagnoses. While the root cause of anxiety and depression (which are often both present) is different for everyone, there are several dietary factors that contribute to these mental disorders.

Our ancestors, whether from one thousand or one hundred years ago, did not fear fat. The low-fat craze is still alive and well, just take a look around your grocery store. Skim milk, low-fat cheese and 0% yogurt are easier to get a hold of than their full-fat counterparts. While our ancestors ate lard, eggs and meat, many people have moved away from this ancestral diet and instead adopted a more plant based, high-carb, low-fat diet.

Not only are we not designed to eat this way, this type of eating has very real effects on the body and brain. Over half of our cells are made up of cholesterol, over 60% of the brain is made up of fat. If you're not eating fat, and the right fats in particular, the brain suffers. A lack of the beneficial omega-3 fattys acids, EPA and DHA, which are especially concentrated in fish oil, has been shown to cause mood disorders. Sarah Conklin, PhD, a postdoctoral scholar in Cardiovascular Behavioral Medicine, Department of Psychiatry at the University of Pittsburgh presented a study that showed low levels of EPA and DHA were related to mood impairment.
We were able to show that individuals who consumed more omega-3 fatty acids in their diets had more gray matter volume in areas of the brain important for regulating mood. These results suggest that these specific fats, certainly not fat in general, may confer a protective effect against depression and other mood-related problems.
And from Dr. Sears,
There are two omega-3 fatty acids in the brain. The first is called docosahexaenoic acid or DHA. This is primarily a structural component for the brain. The other is called eicosapentaenoic acid or EPA. This is the primary anti-inflammatory omega-3 fatty acid for the brain. So if the levels of EPA are low in the blood, they are going to be low in the brain. To further complicate the matter, the lifetime of EPA in the brain is very limited (3,4). This means you have to have a constant supply in the blood stream to keep neuro-inflammation under control.
This new way of eating also contributes to inflammation. A high-grain, low-fat diet that employs the use of vegetable oils causes extreme inflammation. The omega-3 to omega-6 ratio should be about 3:1, instead it's about 30:1 in modern diets. A lack of beneficial fats, like coconut oil, egg yolks, pastured butter and avocados only adds to the problem. According to Dr. Emily Deans,
...inflammatory cytokines also interfere with the regulation of another neurotransmitter, glutamate. Glutamate is an excitatory neurotransmitter that, if left to go wild, can pound our NMDA receptors in the brain and wreak major havoc. No one wants overexcited NMDA receptors, and clinical depression is one among many nasty brain issues that can be caused by overexcitement. Astrocytes, little clean-up cells in the brain, are supposed to mop up excess glutamate to keep it from going nutso on the NMDA. Turns out inflammatory cytokines interfere with the clean-up process.

Finally, inflammatory cytokines also push the brain from a general environment of happy "neuroplasticity" (mediated in part by a type of natural brain fertilizer called "BDNF") towards an environment of neurotoxicity (sounds bad, and it is!).
Inflammation is one of the most damaging conditions for the brain (and well, everything else too!). It is absolutely necessary to eat the correct fats and quite a bit of them to quell inflammation. Foods high in EPA and DHA are wild seafood, pastured meat, organ meats and egg yolks. In Toxic Fat, Dr. Sears discusses the surge in anxiety and depression being linked to an imbalance of AA and EPA.
What causes AA to increase is a combination of increased consumption of vegetable oils rich in omega-6 fatty acids coupled with an increase in the consumption of refined carbohydrates that generate insulin. When excess omega-6 fatty acids interact with increased insulin, you get a surge of AA production. At the same time, our consumption of fish rich in EPA has decreased. The end result is an increasing AA/EPA ratio in the blood, which means a corresponding increase in the same AA/EPA ratio in the brain creating more cellular inflammation.
Food toxins also play a huge role in the onset of anxiety and depression. Not only do they contribute to inflammation, they alter the gut flora. While we are just beginning to understand the gut-brain connection, we know that whatever is occurring in the gut has a direct impact on the brain. From Harvard Medical School,
The brain has a direct effect on the stomach. For example, the very thought of eating can release the stomach's juices before food gets there. This connection goes both ways. A troubled intestine can send signals to the brain, just as a troubled brain can send signals to the gut. Therefore, a person's stomach or intestinal distress can be the cause or the product of anxiety, stress, or depression. That's because the brain and the gastrointestinal (GI) system are intimately connected - so intimately that they should be viewed as one system. (emphasis mine)
A recent study at UCLA demonstrated that yogurt intake could positively effect brain function, particularly feelings of anxiety. According to the researchers,
Four-week intake of an FMPP [fermented milk product with probiotic] by healthy women affected activity of brain regions that control central processing of emotion and sensation.
Considering food toxins like GMOs, vegetable oils, high sugar intake and processed ingredients negatively impact gut flora, it's important to not only eliminate these ingredients but also take a high quality probiotic. While our ancestors regularly ate probiotics via fermented foods and soil, the modern diet is severely lacking.

Prior to soil depletion, soil used to be rich with magnesium. Our ancestors had a regular intake of magnesium from soil as well as bathing in and drinking water rich with magnesium. Unfortunately, soil and drinking water are no longer rich with magnesium.

Magnesium plays a hugely important role in the body; it is required for cell growth and development, normal blood pressure, enables thousands of biochemical processes, contributes to the proper functioning of muscles and nerves, and releases appropriate amount of serotonin in the brain. Without adequate magnesium, the brain will not properly release serotonin. This leads to both anxiety and depression.

I recommend a transdermal magnesium supplement; I personally use this magnesium oil lotion before bed. It is deeply relaxing and promotes restful sleep.

To mitigate the effects of anxiety and depression, eat as closely to nature as possible, like your ancestors did. No fad diets, no 100 calorie snack packs, no low-fat crap. Eat real food. My 21 Day Lifestyle Transformation includes meal plans, recipes and grocery lists to help you overhaul your diet in three weeks.

Also note that I didn't even include other factors like sleep, stress, family life, community, etc. All of these are factors for depression and anxiety. If you do suffer from depression, check out this article on 5 ways to love yourself through depression.