Summary: Chinese justification of South China Sea sovereignty relate to a centuries of interests in the region. China's true motives relate to its economic security.
The common answer - that I personally heard from the mouth of a US government official based at the embassy in Beijing - is that China is using this issue to build public support for the CCP as the Chinese economy weakens. According to this narrative, international conflict will distract people from domestic issues. There might be some truth to this, but there is a bigger issue.
Whether the Chinese economy is strong or weak, their infrastructure projects are not stopping. There are massive natural resource requirements for these projects, and likewise China is a net importer of food. A trade disruption would cause huge problems for their economy, and untold suffering among the population. It is for its own practical security reasons that China seeks to control the South China Sea. A huge amount of trade flows through this area and the Straits of Malacca, as this route is critical for Chinese access to the Middle East, the Indian subcontinent, and Europe. In addition to natural resource imports, the revenue streams from trade is also of critical importance for China.
Why does China feel insecure? Why doesn't China trust the international system to maintain free navigation? Understanding this is important in understanding why China wants military bases in the area. In the past 200 years China has had terrible problems caused by Europeans, Japanese, and Americans. Some examples: the Opium Wars, colonial treaty ports, First Sino-Japnese War, the multinational response to the Boxer Rebellion, the Russo-Japanese War, World War II, and the isolation of communist China until the 1970s. China's living standards increase is only within the past 15 years, so poverty and suffering are in vivid memory of most people. And like people everywhere, Chinese people like to eat, have good access to modern medicine, and a reasonable material life.
China also sees the distinct possibility that it will be a "victim of war"; having seen aggressive wars recently in Iraq, Syria, Libya, Afghanistan, Sudan, Ukraine. While it is nearly certain that there will be no hot war as China is a nuclear weapons holder, with a huge territory and population, and a seat on the UN security council. However, China is vulnerable to economic disruptions. Sanctions - or even the threat of sanctions - would be disastrous for China. This is why China seeks to secure its supply lines in the event of aggressive behavior by the US and Europe.
China justifies its actions in the South China Sea through historical claims that are mentioned on this Wikipedia site.
So what about Southeast Asia? There are a lot of people in these dozen countries; about 600 million. And every single one of these people has economic interest tied up in the South China Sea. These people also bore the violence of colonialism and WWII; the region is still in recovery from the US's anti-communist wars in the 1960's and 1970s. This newspaper article is a nice introduction to the issue from a SE Asian perspective.
Why is China trying to take the entire Sea for itself instead of the obvious method of breaking the sea up into smaller territories? Why doesn't China just acknowledge and respect Southeast Asia's needs? There are a couple of reasons: firstly, ownership of a small part will not ensure China's access to African and Middle Eastern natural resources and other foreign markets. If any part of the sea is blocked, then it becomes merely a place to fish and extract oil. Secondly, China's government is responsible to its own people, not to those of SE Asia. It views its security concerns as of vital importance, whereas it does not view itself as a threat to its neighbors; it knows that it can't close the sea to the Philippines or Vietnam. It would be very difficult. It also clearly states continuously that it wants to ensure that the South China Sea is open for Navigation.
So what about US interests in the area? I have been trying to understand this point, and have asked a probing question a few days ago over at SE History. As far as I can tell, the US is involved in politics everywhere in the world, and has many fingers in many pies. I very much want to understand the US motives more clearly.