Hari Singh, the hereditary leader of the region, wanted to remain independent. Pakistan invaded. He fled to India and hand over the state to India. India fought back to defend its new claims. Pakistan kept a portion after a cease fire.
They invaded again and started an ethnic cleansing. India invaded and almost destroyed Pakistan and retained the property. China has claims like any greedy neighbor wanting the place for its water. It is the reason the invaded and still hold Tibet. Maybe they should have gone with India.
The region is a mess. India cannot give up the area. Its survival depends on holding on to it hence their hard line stance. With it falling into the hands of Pakistan, over a 100 millions down stream will lose their water supply as it is diverted to Pakistan. India will never let Kashmir go.