These two sciences are pretty new to humanity. Capitalism was first formalised by Adam Smith, but we did have economic systems before that. Most of these pre-capitalistic systems said that people could never be trusted to behave rationally, and should be subjects of rulers. Any opposition was violently repressed. There was essentially a 100% government tax, the lifes of everyone below them. Feudalisms' serfdom being the perfect example of these systems.
Adam Smith's true insight was that when people were left to their own devices, such as in the workshops of the time, they would make rational choices and quickly increase productivity, and subsequently the Wealth of Nations. The existing social structure of Corporations was the best way to acheive this and was adapted for it's use.
Enter the Industrial Era of humanity, and we'd never had it better. Adam Smith's legacy is the kickstart of the study of economics, but he was greatly aided by people such as David Hume and David Ricardo.
The problem was, of course, that relying purely on self interest for direction didn't exactly always turn out well. Most people were living in abject conditions, surviving not much longer than they did before capitalism. The Wealth of Nations certainly increased, but the wealth of the people didn't change too much.
Karl Marx jumped on this moral dilemma with a vengeance. The "capitalistic democracy" was a sham of the elites. The average working man never had any say, and capital always accumulated with the wealthy. However, there was an existing state institution in which everyone in it was clothed, trained, and fed daily - the military. The State had an incentive to keep it's soldiers in top shape to defent the Nation, and they did. History had proven how much more successful generals and emperors, such as Napoleon, had been when they treated their soldiers well and listen to their advice. Napoleon had risen from fairly humble belongings to become a highly successful coup d'etat emperor. He saw that Meritocracy from below was better suited at ensuring the sharing of success - the workers nomianting the best amongst them to govern. Everyone had to give what they could to the state, and they would receive what they needed in return.
It's a very nice economic theory, but just like classical capitalism, it just doesn't work unaltered.
These two systems clashed for a long time against eachother. Enter perhaps the greatest economist ever to have lived: John Maynard Keynes. He suggested a marriage of the two schools into Macroeconomics -looking at the big picture. His particular brand of it was named Keynesian Economics. The government had to interfere in the market to ensure maximum beneficial equality of wealth. Not perfect equality of wealth, but one that focus on maximizing the wealth of the middle class.
So to the question: Which is the better one between Capitalism or Socialism? Well, neither. And both. They both have compelling and appaling practical applications - neither one should be championed.