There is a lot of speculation on where the "man-eating lions of Tsavo" came from... and that might shed light on why they were eating people. If they were natural lions, born and bred in the wild, than there is a simple explanation for why they might eat people... because we're EASY prey and as it happens the railroad they were building out there was in the middle of nowhere. These lions very likely weren't used to that many people (or their weapons) and may have just seen us as new easy prey.
I tend to believe in a bit most dastardly hypothesis though. These "lions" were unusually large... too large in fact. They may have been lion tiger crosses. Such a cross would cause unmatched growth capacity. But where would one of these creatures come from with no tigers around? Good question. The railroad being built was not supported on all sides by everyone. There was a lot of people angry about it being built in the area... and it's not that much of a stretch to think these creatures might have been purposely bred by humans and set loose to do their damage. An animal such as this used to being fed by humans and with no real hunting abilities due to captivity would very quickly turn to humans instead of starving to death. Or they may have even been trained to eat humans. Whose to say, it was a long time ago.
But really... we'll probably never know. It's fun speculating though!