Chinese ceramics from the 8th century have been found at Santubong, on the peninsula at the river mouth. Santubong was Sarawak's capital in 1599, and Lidah Tanah took over in the early 1820s. Kuching came third. Brunei's man on the spot, Pengiran Indera Mahkota, founded it in 1827, after antimony ore turned up on the upper Sarawak River in 1824. Singapore wanted the ore.
Mahkota's tax and labour demands angered the local Malay chiefs, who moved upriver, allied with Dayaks and rebelled. The Bruneian prime minister, Pengiran Raja Muda Hashim, offered the governorship to a British adventurer, James Brooke, who was appointed Rajah on 24 September 1841. His family then ruled Sarawak as a personal kingdom until 1941.
Charles Brooke, the second Rajah, built up the town. By 1874 it had a hospital, a prison and Fort Margherita, plus a sanitation system. Around 1870 he put up the Astana palace as a wedding gift for his wife Margaret; it still stands across the river from the Waterfront and is the residence of Sarawak's head of state. The fort, finished in 1879, now holds the Brooke Gallery. You can reach it by small ferry from the Waterfront. In 1872 he also gave the town its present name, Kuching.
Chinese traders shaped the town from early on. They came after the antimony find, and again when the last Rajah, Vyner Brooke, encouraged Chinese migrants to plant black pepper. Their oldest temple, Tua Pek Kong, dates from 1843. Water was a problem: when cholera broke out in 1888, a well on China Street in the Main Bazaar supplied clean water. One theory says the city's name comes from the Chinese for old well.
Japanese forces took Kuching on 24 December 1941 and held Sarawak for three years and eight months. From March 1942 they ran a prison camp for prisoners of war and civilians at Batu Lintang, 5 km out of town. The surrender was signed on 11 September 1945 aboard HMAS Kapunda at Kuching. The town came through the war undamaged.
On 1 July 1946 Vyner Brooke handed Sarawak over to Britain. Sarawak joined North Borneo, Singapore and Malaya to form Malaysia on 16 September 1963, and Kuching kept its place as state capital. It became a city on 1 August 1988 and is the only city in Malaysia run by two mayors, one for the north and one for the south. In 2015 it was declared a place of racial harmony, citing mixed marriages and mixed schools.