Scientists have filled libraries trying to answer this question so check out this video where Steven Colbert challenges Steven Pinker to explain how the brain works in 5 words or less.
A very key part of your brain that influences a great deal of your behavior is the amygdala.
Notice how it is directly connected to the hippocampus who's main function deals with memory. In addition researchers have mapped some of the connections the amygdala has with other parts of the brain.
From this image you can clearly see that the amygdala is well positioned to widely influence brain function. Much like the hub of a bicycle wheel.
Its often difficult for students to get a handle on the various structures of the brain. Getting a little more information and applying it to your own experience can often bring complex concepts to life.
Check out these two articles for information about the function of the amygdala. Think about how this new knowledge might relate to when you experienced fear. In what way are the signals coming from your amygdala important for your survival?