There are four main reasons for this:
-The Realities of Participation: One of the major reasons for the failure of the League of Nations (the predecessor of the United Nations) was the lack of participation of the United States. It also had other flaws, but those are only tangentially related to the question.
So, in order to get the major powers to participate within the framework of the U.N., you had to incentivize membership for them. Thus, veto power within the new Security Council was a great carrot to dangle to the various powers (most importantly the U.S. and U.S.S.R).
-The Decline of Colonialism: The early part of the Twentieth Century saw the beginnings of the end of the great colonial empires. The First World War had exhausted the European powers to the point that it became more difficult for them to hold on to their oversees possessions. Many in Europe could see that the Second World War would do nothing to alleviate that problem. So, one of the measures Britain and France could undertake to keep positions of authority even as their empires begin to collapse was to have that veto power. The League of Nations required non-procedural decisions to be unanimous. The U.N. would have no such requirement; majority ruled. However, the General Assembly's resolutions would be non-binding. So, even if a resolution were adopted there that was unfavorable to them, the great powers could ignore it. But, the Security Council's resolutions had more force behind them. So, giving the great powers veto power ensured that they would retain their authority within the U.N. even if they lost it on the world stage.
-The Realities of Armies: The Security Council was seen as a body of action and active intervention. If the Security Council voted to intervene in an affair, then that meant that troops were to be deployed. In 1945, the major militaries of the world with the capability to reach far away were those of the five permanent members. So, in 1945, if the Security Council voted to go to war, it would be the permanent members doing the majority of the fighting.
-The Spoils of War: Though by the End of World War II, the Allies consisted of more than 20 countries and all of those countries put soldiers on the front lines who fought and dies to stop the Axis, the major contributors to the War were the five permanent members. They had lost the most, contributed the most, and were the most powerful of the Allies. Thus, one of their rewards for those sacrifices was the veto power.
I hope this answers your question. Some great sources on the subject include:
United Nations: A History by Stanley Meisler
The United Nations Website --> http://www.un.org/en/sections/history/history-united-nations/
Postwar: A History of Europe Since 1945 by Tony Judt
If any other posters have good source, please post.
Edit: Formatting