A bit of history is necessary to understand the issue:
At the time of the British withdrawal from India, Maharaja Hari Singh, the ruler of the state, preferred to become independent and remain neutral between the successor dominions of India and Pakistan. However, an uprising in the western districts of the State followed by an attack by raiders from the neighbouring Northwest Frontier Province, supported by Pakistan, put an end to his plans for independence. On 26 October 1947, the Maharaja signed the Instrument of Accession joining the Dominion of India in return for military aid. The western and northern districts presently known as Azad Kashmir and Gilgit-Baltistan passed to the control of Pakistan, while the remaining territory became the Indian state Jammu and Kashmir.
The Instrument of Accession was limited to certain issues. It did not dissolve the autonomous state:
The Instrument of Accession signed by then-Maharaja Hari Singh of Kashmir in October 1947 specified only three subjects on which the state would transfer its powers to the Government of India: foreign affairs, defence and communications. In March 1948, the Maharaja appointed an interim government in the state, with Sheikh Abdullah as the prime minister. The interim government was also tasked with convening a constituent assembly for framing a constitution for the state. In the meantime, the Constituent Assembly of India was conducting its deliberations. In July 1949, Sheikh Abdullah and three colleagues joined the Indian Constituent Assembly and negotiated the special status of J&K, leading to the adoption of Article 370.