Xiamen Island was considered to possess one of the world's great natural harbors in Yundang Bay, but Fujian's international trade was long restricted to Quanzhou or to Guangzhou in Guangdong. Due to thesiltification of Quanzhou's harbor, the British insisted that Xiamen be opened to foreign trade in thetreaty that ended the First Opium War in 1842. Under the Qing, both before and after the war, there was large-scale emigration of Chinese from southern Fujian spread Hokkien-speaking communities to Singapore,Malaysia's Penang, Indonesia's Riau Province and the Philippines. The overseas Chinese continue to support Xiamen's educational and cultural institutions. As part of China's Opening Up Policy under Deng Xiaoping, Xiamen became one of the original four special economic zones opened to foreign investment and trade in the early 1980s. Its former harbor was enclosed using land excavated during the city's expansion.
The city is known for its mild climate, Hoklo influence and colonial architecture, as well as its relatively low pollution. In 2006, Xiamen was ranked as China's 2nd-"most suitable city for living", as well as China's "most romantic leisure city" in 2011.The area around Xiamen Bay appears as Tong'an in some Han records.Xiamen Island was described as Jiahe Islet c. 976. It received its present name from the Xiamen Castle erected on the island by Zhou Dexing in 1387 during the Ming. The name was formerly written using theChinese characters meaning "Lower Gate". When its port prospered under the Qing, the name was considered unrefined and changed to homophonous characters meaning "Mansion Gate". Xiamen is the atonal pinyinromanization of the characters' pronunciation in Mandarin. It has also been romanized as Hiamen. The former English name "Amoy" was based on the same name's pronunciation in the local dialect of Hokkien, Ē-mûi.
Xiamen was also named Siming ("Remembering the Ming") for a few years (1656–c. 1661) during its occupation by the loyalist Southern Ming forces of Koxinga. The Qing restored the former name upon their conquest of the area, but Koxinga's name was in turn restored after the Xinhai Revolution that inaugurated the republic in 1912. The name Xiamen was later restored again but Siming continues to be used as the name of one of its districts.The area of Xiamen was largely bypassed by the Qin and Han conquests and colonization of Guangdong, which passed west of Fujian down the Lingqu Canal between the Xiang and Li rivers. It was first organized as Tong'an County inad 282 under the Jin, but it lost this status soon afterwards. Tong'an County was again established in 933 under the Later Tang.
The settlement on the southeastern shore of Xiamen Island (now part of Siming District) developed as a seaport under the Song, although legal foreign trade was restricted to nearby Quanzhou, which administered the area. In 1387, attacks by the "Japanese" or "dwarf" pirates—many of them actually disaffected Chinese—prompted the Ming to protect the harbor with the fortress that gave Xiamen its name. The Portuguese first reached Xiamen in 1541. After the fall of the Ming to the Qing in 1644, Southern Ming loyalists including Koxinga used Xiamen as a base from which to launch attacks against the invading Manchus from 1650 to 1660. In 1661, Koxinga drove the Dutch fromTaiwan and moved his operations there. His base on Xiamen fell to a combined Qing and Dutch invasion in 1663. The East India Company traded extensively with the port, constructing a factory there in 1678. It was raised to the status of a subprefecture in 1680, but the taxes and other restrictions placed on traders compelled the British to relocate to Canton and Fuzhou the next year. Trade resumed in 1685 and continued until the imposition of the Canton System.By the 19th century, the city walls had a circumference of around 9 miles (14 km), with an inner and outer city divided by an inner wall and a ridge of hills surmounted by a well-built fort. The inner harbor on Yundang Bay was also well fortified and these defenses were further strengthened upon the outbreak of the First Opium War. Nonetheless, Xiamen was captured in 1841 between Guangzhou and Zhoushan. Rear Adm. Parker bombarded the Qing position to little effect, but the assault by the men under Lt. Gen. Gough caused the Chinese to flee their positions without a fight. The city was abandoned during the night and fell the next day on 27 August. The Chinese had spirited out the entire treasury of sycee bullion under the nose of the British by disguising it inside hollow logs. Xiamen being too large to garrison, a small force was left to hold Gulangyu. The next year, the Treaty of Nanjing made Xiamen one of the first five ports opened to British trade, which had previously been legally restricted to Guangzhou. Subsequent treaties opened the port to other international powers. As the primary international port for Fujian, particularly Zhangzhou and its hinterland, Xiamen became a center of China's tea trade, with hundreds of thousands of tons shipped yearly to Europe and the Americas. Its local dialect influenced a variety of translations of Chinese terms. Its principal exports during the period were tea, porcelain, and paper; it imported sugar, rice, cotton, and opium, as well as some manufactured goods. Xiamen was also a center of Protestant missionaries in China; the missions operated the city's two hospitals. The merchants of Xiamen were thought among the richest and most entrepreneurial and industrious in China, but the city was widely accounted the dirtiest city in China. Owing to local belief in feng shui, the streets were "as crooked as ram's horns" and averaged about 4 feet (1 m) in width to keep out sunlight and control public disturbances. Its population was estimated at 250,000 in the 1870s; by that point the island was largely barren and full of roughly 140 villages, with a total population around 400,000. European settlement in the port was concentrated on Gulangyu Island off Xiamen proper; it remains known for its colonial architecture. By the 20th century, the local export economy had collapsed due to the success of British tea plantations in India. During the Qing and the early 20th century, many southern Fujianese emigrated to Southeast Asia and Taiwan, spreading Hokkien language and culture overseas. Some 350,000 overseas Chinese currently trace their ancestry to Xiamen. Some of this diaspora later returned: an estimated 220,000 Xiamen residents are returning overseas Chinese and their kin. Others continue to help fund universities and cultural institutions in Xiamen. At the time of the Xinhai Revolution, the native population of the city was estimated at 300,000 and the foreign settlement at 280. After the establishment of the Republic of China, the area around Xiamen was renamed Siming County. Xiamen's trade during the period was largely conducted through Taiwan, which had been seized by Japan during the First Sino-Japanese War. The Japanese subsequently claimed Fujian as their sphere of influence during the colonial squabbling over China. Japan occupied Xiamen Island from May 1938 to September 1945 during World War II. In the late phases of the Chinese Civil War that followed, the Communists captured Xiamen and Gulangyu in October 1949 butfailed to capture Jinmen. The same year, Xiamen became a provincially-administered city (省辖市). In 1955 and 1958, mainland China escalated Cold War political tensions by shelling nearby islands from Xiamen in what became known as the First and Second Taiwan Strait Crisis. The Nationalists responded by reïnforcing Jinmen and shelling Xiamen. The Gaoji Causeway built from 1955–57 notionally transformed Xiamen Island into a peninsula, and so it was termed in the heady propaganda of the time. Due to political tensions, the eastern half of Xiamen Island and much of the Fujian Coast facing the offshore islands remained undeveloped in the 1960s and 1970s. The Water Police and Post-Office were situated directly across the water from the American embassy.
When Deng Xiaoping initiated his Opening Up Policy, Xiamen was made one of the first four special economic zones in 1980, with special investment and trade regulations attracting foreign investment, particularly from overseas Chinese. The city grew and prospered. On 18 April 1988, Xiamen was promoted to sub-provincial status and began to be specially considered in China's state planning. In 2001, the governments of mainland China and Taiwan agreed to initiate the "Three Mini-Links" and restored ferry, commercial, and mail links between the mainland and offshore islands. Trade and travel between Xiamen and Jinmen was restored and later expanded to include direct air travel to Taiwan Island. In 2010, travelers between Xiamen and Jinmen made 1.31 million trips.In 1999, the largest corruption scandal in China's history was uncovered in Xiamen, implicating up to 200 government officials. Lai Changxing is alleged to have run an enormous smuggling operation, which financed the city's football team, film studios, largest construction project and a vast brothel rented to him by the local Public Security Bureau. According to Time, "locals used to joke that Xiamen should change its name to Yuanhua, the name of Lai's company." They subsequently claimed that potential investors were discouraged by the taint of corruption.
In 2006, Xiamen was ranked as China's 2nd-"most suitable city for living", as well as China's "most romantic leisure city" in 2011.