Surabaya is believed to have been founded some time towards the end of the thirteenth century. The name is a combination of the words for "shark" and "crocodile", and comes from a legendary battle between the two to establish which was the strongest animal. Statues and depictions of the battle litter the city.
The founding of the city roughly coincides with the expulsion of Mongul-Chinese invaders and the rise of the Hindu Majapahit empire, which ruled the area for around 200 years. After the fall of Majapahit, Surabaya became a sultanate in its own right and spent the next 200 years fighting off the Islamic Mataram, Madura and the Dutch.
The city ultimately fell to Mataram early in the seventeenth century in one of the most bloody battles in Java's history. Mataram weakened over the next 100 years and was ultimately subsumed by the Dutch East Indies Company. The Dutch turned Surabaya into a major trading port and even then based most its navy there.
The city was captured by the Japanese during World War II. Indonesian nationalists forced out the Japanese in 1944. However, the Dutch and their western allies returned in 1945 and tried to re-exert their control over the city. It was the raising of the Dutch flag over what is now the Hotel Majapahit in 1945 that sparked off a series of events that led to the "Battle of Surabaya" and ultimately Indonesian independence on 17 August 1949. The battle itself was preceded by a series of what today would be called terrorist events that culminated in a car bombing that killed the British Brigadier General Mallaby at the Jembatan Merah, or Red Bridge as it's known in English. Today, the decidedly un-photogenic Red Bridge is a standard stop on tours of the city.