Dutch residenthuis (resident house) along the water in Surabaya
Surabaya alludes to a prophecy of Jayabaya, a 12th-century psychic king of Kediri Kingdom, foreseeing a fight between a giant white shark and a giant white crocodile taking place in the area, which is sometimes interpreted as foretelling the Mongol invasion of Java, a major conflict between the forces of Kublai Khan, Mongol ruler of China, and those of Raden Wijaya's Majapahit in 1293. The two animals are now used as the city's symbol, with the two facing and circling each other, as depicted in a statue appropriately located near the entrance to the city zoo.
Alternate derivations proliferate: from the Javanese sura ing baya, meaning "bravely facing danger"; or from the use of surya to refer to the sun. Some people consider Jayabaya's prophecy as being about the great war between native Surabayan people and foreign invaders at the start of the war of independence in 1945. Another story tells of two heroes who fought each other to be the king of the city. The two heroes were named Sura and Baya. These folk etymologies, though embraced enthusiastically by its people and city leaders, are unverifiable.
Map of Surabaya from an 1897 English travel guide
The Kingdom of Janggala was one of the two Javanese kingdoms that was formed in 1045 when Airlangga abdicated his throne in favour of his two sons. The earliest historical record of Surabaya was in the 1225 book Zhu fan zhi written by Zhao Rugua, in which it was called Jung-ya-lu. The name Janggala was probably originated from the name "Hujung Galuh" (Old Javanese lit: "Cape Diamond" or "Cape Gemstone"), or "Jung-ya-lu" according to Chinese source. Hujung Galuh was located on the estuarine of Brantas River and today is the part of modern Surabaya city and Sidoarjo Regency. The earliest historical record of Surabaya was in the 1225 book Zhu fan zhi written by Zhao Rugua, in which it was called Jung-ya-lu.
The name Janggala was probably originated from the name "Hujung Galuh" (Old Javanese lit: "Cape Diamond" or "Cape Gemstone"), or "Jung-ya-lu" according to Chinese source. Hujung Galuh was located on the estuarine of Mas River, one of tributaries of Brantas River and today is the part of modern Surabaya and Sidoarjo.
By the 14th to 15th centuries, Surabaya seems to be one of Majapahit ports or coastal settlements, together with Tuban, Gresik, and Hujung Galuh (Sidoarjo). Ma Huan documented the early 15th-century visit of Zheng He's treasure ships in his 1433 book Yingya Shenglan: "after traveling south for more than 20 li, the ship reached Sulumayi, whose foreign name is Surabaya. At the estuary, the outflowing water is fresh".Tomé Pires mentioned that a Muslim lord was in power in Surabaya in 1513, though likely still a vassal of the Majapahit.
Ma Huan visited Java during Zheng He's fourth expedition in the 1413, during the reign of Majapahit king Wikramawardhana. He describes his travel to Majapahit capital, first he arrived to the port of Tu-pan (Tuban) where he saw large numbers of Chinese settlers migrated from Guangdong and Chou Chang. Then, he sailed east to thriving new trading town of Ko-erh-hsi (Gresik), Su-pa-erh-ya (Surabaya), and then sailing inland into the river by smaller boat to southwest until reached the Brantas river port of Chang-ku (Changgu). Continuing to travel by land to the southwest, he arrived in Man-che-po-I (Majapahit), where the Javanese king stayed.
By late 15th century, Islam began to take its root in Surabaya. The settlement of Ampel Denta, located around Ampel Mosque in today Ampel subdistrict, Semampir district, north Surabaya, was established by a charismatic Islamic proselytizer Sunan Ampel.
In the late 15th and 16th centuries, Surabaya grew to be a duchy, a major political and military power in eastern Java. The Portuguese writer Tomé Pires mentioned that a Muslim lord was in power in Surabaya in 1513, though likely still a vassal of the Hindu–Buddhist Majapahit. At that time, Surabaya was already a major trading port, owing to its location on the River Brantas delta and on the trade route between Malacca and the Spice Islands via the Java Sea. During the decline of Majapahit, the lord of Surabaya resisted the rise of the Demak Sultanate, and only submitted to its rule in 1530. Surabaya became independent after the death of Sultan Trenggana of Demak in 1546.
The Duchy of Surabaya entered a conflict with, and was later captured by, the more powerful Sultanate of Mataram in 1625 under Sultan Agung. It was one of Mataram's fiercest campaigns, in which they had to conquer Surabaya's allies, Sukadana and Madura, and to lay siege to the city before capturing it. With this conquest, Mataram then controlled almost the whole of Java, with the exception of the Sultanate of Banten and the Dutch settlement of Batavia.
The expanding Dutch East India Company took the city over from a weakened Mataram in November 1743. In consolidating its rule over Surabaya, and in time, the rest of East Java, the Dutch collaborated with leading regional magnates, including Ngabehi Soero Pernollo (1720–1776), his brother Han Bwee Kong, Kapitein der Chinezen (1727–1778), and the latter's son, Han Chan Piet, Majoor der Chinezen (1759–1827), all from the powerful Han family of Lasem.
In the 18th and 19th centuries, Surabaya was the largest city in Dutch East Indies. It became a major trading centre under the Dutch colonial government, and hosted the largest naval base in the colony. Surabaya was also the largest city in the colony serving as the centre of Java's plantation economy, industry and were supported by its natural harbour. In 1920, a census recorded that Batavia had become the largest city.
In 1917, a revolt occurred among the soldiers and sailors of Surabaya, led by the Indies Social Democratic Association. The revolt was firmly crushed and the insurgents given harsh sentences.
Japan occupied the city in 1942, as part of the occupation of Indonesia, and it was bombed by the Allies in 1944. After the Japanese surrender at the end of World War II, Surabaya was seized by Indonesian nationalists. The young nation soon came into conflict with the British, who had become caretakers of the Dutch colony after the surrender of the Japanese.
The Battle of Surabaya, one of the well-known battles of the Indonesian revolution, started after the Arek-Arek Suroboyo (Teenagers of Surabaya) assassinated the British Brigadier Mallaby on October 30, 1945, near Jembatan Merah (the "Red Bridge"), allegedly with a stray bullet. The Allies gave an ultimatum to the Republicans inside the city to surrender, but they refused. The ensuing battle, which cost thousands of lives, took place on November 10, which Indonesians subsequently celebrate as Hari Pahlawan (Heroes' Day). The incident of the red-white flag (the Dutch flag at the top of Yamato Hotel's tower that was torn into the Indonesian red-white flag) by Bung Tomo is also recorded as a heroic feat during the struggle of this city.
The city is known as Kota Pahlawan "city of heroes" due to the importance of the Battle of Surabaya in galvanizing Indonesian and international support for Indonesian independence during the Indonesian National Revolution.
In June 2011, Surabaya received the Adipura Kencana Award as number one among 20 cities in Indonesia. Surabaya was reported by a Singaporean as being clean and green.