Heraklion is close to the ruins of the palace of Knossos, which in Minoan times was the biggest centre of population on Crete. So it is very likely that there was a port here as long ago as 2000 BC. There is however no archaeological evidence for such a port. Other very important Minoan era ruins are found in or around Archanes village (a few km after Knossos), in Anemospilia, Fourni and Vathipetro.
The present city of Heraklion was founded in 824 AD by the Saracens (an Arabic Muslim people). They built a giant ditch around the city for protection. They named the city Khandak, meaning 'moat', after the ditch. The Saracens allowed the port to be used as a safe haven for pirates, much to the annoyance of the nearby Byzantine Empire.
In 961, the Byzantines attacked and defeated the city, slaughtered all the Saracens, looted the city and burned it to the ground. They remained in control of the rebuilt Khandak for the next 243 years.
In 1204, the city was bought by the Venetians as part of a complicated political deal which involved among other things, the Crusaders of the Fourth Crusade restoring the deposed Byzantine emperor Isaac II Angelus to his throne.
The Venetians improved on the ditch by building enormous fortifications, most of which are still in place, including a giant wall, in places up to 40m thick, with 7 bastions, and a fortress in the harbour. The name Khandak became Candia in Italian. The city retained the name of Candia for centuries, and the whole island of Crete was often called Candia as a result.
After the Venetians came the Turks of the Ottoman Empire. They besieged the city for 22 years in a bloody war in which 30,000 Cretans and 120,000 Turks died. The Venetians eventually handed it over in 1669. The city was renamed during the Turkish occupation to Megalo Kastro (Big Castle). During their occupation, the harbour silted up, so they moved most of their business to Hania in the west of the island.
The city became independent with the withdrawal of the Ottomans in 1898, then part of the 1908 Cretan state, and then it was incorporated into the Kingdom of Greece in 1913. Upon its independence it was renamed to 'Heraklion', meaning City of Heracles (Hercules), after the port of Heracleum which had existed somewhere in the locality in Roman times.
The biggest monument of the city is the Venetian medieval fortress Rocca al Mare (also known as Koules) located on the port.