Beating kids seemed to work out fine for thousands of years then in some parts of the world in less than a human lifetime its become a great taboo. What was the cause of this?
Your question is based on a flawed premise: that severe corporal punishment (i assume thats what you mean by "beating kids?") was common and universal up to a certain point in history. But this is not the case - there have been numerous periods and cultures where "beating children" was not the norm. The idea that it's an acceptable parenting method has gone in and out of style at different times and among different social groups/classes in western history, although you're broadly correct that the idea that you should never hit (or slap, or spank) a child is of relatively recent vintage. That only started to become the dominant view in the US during & after the 1950s. Note, though, that not everyone shares that view even today, and corporal punishment is likely a lot more common than you'd think.
If you're asking how/why the idea that any kind of corporal punishment is bad became as popular as it is today, the answer is kind of complicated. I'm on my mobile atm so can only paint this in broad strokes - but basically it has to do with the growth of a consensus about the causes and effects of childhood psychological trauma among developmental psychologists, and a change in parents' attitude towards their children. As children have become increasingly "priceless" to parents emotionally, and parents have become increasingly obsessed with giving their children a "proper" childhood that will make them both "well adjusted" and successful, corporal punishment has become less and less attractive.
Happy to expand on this if people have questions or if I've been unclear.