Answer by Rory Young:
There are five main reasons an animal will attack you, The first is fear. Cape Buffaloes are a classic example. They are really bad news. This is not because they want to eat you but because they believe you want to eat them. Why else would we be walking around on our back legs, showing our teeth and the whites of our eyes? Lions, when completely unused to people will run away when they encounter humans but of course if surprised at close range could attack out of fear to defend themselves (and then eat you as a bonus).
The second is for food. Lions are pure predators (forget Simba – think Dexter), unlike us who are half predator. They are geniuses at killing. When you see lions lounging around gazing at antelope in the distance, they are not goofing out, they are constantly updating their knowledge of their prey's habits. So, when they lose their fear of man they will begin to test you. There was a very sad case in a park where I once worked in Zimbabwe of a young British chap working for a fellow walking safari guide for his gap year. He left his tent slightly unzipped and was pulled out of it and killed by a lioness. In the lead up to this several guides/rangers including myself had had close calls with lions walking right up to check us out. Normally they would let you know you were getting too close by growling, running away or even mock charging. However, walking casually up to you was not the usual MO. These lions had become so used to being approached on foot that they lost their fear of man and began to wonder if we were easy food and eventually tried.
The third is territory. A good example of this is hippos. They are responsible for killing more people than any other wild mammal. Most of these are unexpected attacks by territorial animals in the water. They will attack out of fear such as when they are in the shallows cut off from the safer deep water by a canoe or run you down if you get between them and the water when they are surprised, but most attacks are deliberate.
The reason for this different behaviour is the habits and different environment. Hippos feed on grass inland during the day and then lie up in pods, large groups squashed next to each other. If a hippo who is not from the pod approaches they will either kill it or chase it away. They do the same with boats that's all.
The fourth reason is anger. A good example of this is when male elephants go into season. This is called "musth". They have huge amounts of testosterone pumping through them and will attack anything.
The fifth reason is to protect their young. In this case you need to back off quickly, walking backwards. Good luck.
P.S. I will post a story on my blog tomorrow, written by a friend who bumped into a leopard with her cubs. He was badly mauled but survived. You are actually better off being attacked by a leopard, especially in a group, as they will attack and maul each person, resulting in a number of mauled people, whereas a lion will stay on the first person till they are dead.
Here is the link