It is not certain if the region was inhabited during Neolithic times. However, there is evidence of the emergence of prehistoric pottery and granite burial monuments in the form of megalithic tombs in the 10th century BC; they resemble their counterparts in Western Europe and other parts of Asia. These are thought to be produced by speakers of a proto-Tamil language. Kerala and Tamil Nadu once shared a common language, ethnicity and culture; this common area was known as Tamilakam.
According to legend, Kerala was an Asura-ruled kingdom under Mahabali. Onam, the national festival of Kerala, is dedicated to Maveli's memory. Another legend has Parasurama, an avatar of Mahavishnu, throwing his battle axe into the sea; from those waters, Kerala arose.
The ancient Cheras, whose mother tongue and court language was Tamil, ruled Kerala from their capital at Vanchi. They were constantly at war with the neighbouring Chola and Pandya kingdoms. A Keralite identity, distinct from the Tamils and associated with the second Chera empire, became linguistically separate under the Kulasekhara dynasty (c. 800-1102). By the beginning of the 14th century, Ravi Varma Kulasekhara of Venad established a short-lived supremacy over southern India. After his death, Kerala became a conglomeration of warring chieftaincies, among which the most important were Calicut in the north and Venad in the south.
The Chera kings' dependence on trade meant that merchants from West Asia and Southern Europe could establish coastal posts and settlements in Kerala. The Jewish, Christian, and Muslim immigrants established Nasrani Mappila and Muslim Mappila communities. The Jews first arrived in Kerala in 573 BC. The works of scholars and Eastern Christian writings state that Thomas the Apostle visited Muziris in Kerala in 52 AD to proselytize amongst Kerala's Jewish settlements. However, the first verifiable migration of Jewish-Nasrani families to Kerala is of the arrival of Knai Thoma in 345 AD . Muslim merchants (Malik ibn Dinar) settled in Kerala by the 8th century AD and introduced Islam. After Vasco Da Gama's arrival in 1498, the Portuguese gained control of the lucrative pepper trade by subduing Keralite communities and commerce.
Conflicts between Kozhikode (Calicut) and Kochi (Cochin) provided an opportunity for the Dutch to oust the Portuguese. In turn, the Dutch were ousted by Marthanda Varma of the Travancore Royal Family who routed them at the Battle of Colachel in 1741. In 1766, Hyder Ali, the ruler of Mysore invaded northern Kerala, capturing Kozhikode in the process. In the late 18th century, Tipu Sultan, Ali's son and successor, launched campaigns against the expanding British East India Company; these resulted in two of the four Anglo-Mysore Wars. He ultimately ceded Malabar District and South Kanara to the Company in the 1790s. The Company then forged tributary alliances with Kochi (1791) and Travancore (1795). Malabar and South Kanara became part of the Madras Presidency.
Kerala saw comparatively little defiance of the British Raj. Nevertheless, several rebellions occurred, including the 1946 Punnapra-Vayalar revolt, and leaders like Velayudan Thampi Dalava, Kunjali Marakkar, and Pazhassi Raja earned their place in history and folklore. Many actions, spurred by such leaders as Vaikunda Swami, Sree Narayana Guru and Chattampi Swamikal, instead protested such conditions as untouchability; notable was the 1924 Vaikom Satyagraham. In 1936, Chitra Thirunal Bala Rama Varma of Travancore issued the Temple Entry Proclamation that opened Hindu temples to all castes; Cochin and Malabar soon did likewise. The 1921 Moplah Rebellion involved Mappila Muslims rioting against Hindus and the British Raj.
After India gained its independence in 1947, Travancore and Cochin were merged to form Travancore-Cochin on 1 July 1949. On 1 January 1950 (Republic Day), Travancore-Cochin was recognised as a state. The Madras Presidency was organised to form Madras State several years prior, in 1947. Finally, the Government of India's 1 November 1956 States Reorganisation Act inaugurated the state of Kerala, incorporating Malabar district, Travancore-Cochin (excluding four southern taluks, which were merged with Tamil Nadu), and the taluk of Kasargod, South Kanara. A new legislative assembly was also created, for which elections were first held in 1957. These resulted in a communist-led government through ballot - the world's first of its kind - headed by E.M.S. Namboodiripad. Subsequent social reforms favoured tenants and labourers. As a result, living standards, education, and life expectancy improved dramatically.