Classical conditioning is a psychological phenomena where a person or animal develops subconscious associations due to pattern recognition. This can prompt a certain emotional or physical state in response to a particular stimulus. A famous example is Pavlov and his dogs. Physiologist Ivan Pavlov conducted an experiment where he would ring a bell and then feed his dogs. Over time, the dogs grew to associate the ringing of the bell with feeding and hunger. They became conditioned so that, regardless of the presence of food, the sound of the bell ringing made the dogs hungry.
People can become classically conditioned into developing a fear if there is a pattern of stimulus and response in their lives. As an example, let's say someone has a series of bad experiences with closets—maybe they become trapped in one while playing hide-and-seek, then open a closet to find a spider, and again open a closet to have a number of boxes fall on them! This would be an unfortunate series of events, indeed, and this person may very well develop a fear of closets.