The brain inputs information through your senses and stores some of it in your memory. Behavior is how you react to things in your life based on the information coming in from your senses and past experiences. The behavioral output is altered by body chemistry and your ability to reason.
A person sees a dog in the street. Their memory reminds them of the time they were attacked by a dog. Their reasoning tells them this may be a repeat of the earlier attack. Their adrenalin starts to pump and they react. The behavior of different people would depend on their memory, emotional level and ability to reason out ways to avoid the dog.
Obviously, this is a very simplified answer. The function of the brain is very complicated and far from being well understood.