Human settlements were present in the area since the Bronze Age (3rd–2nd millennium BC), and it was later probably settled by Sicels, Messapii and Iapyges.
When the Saracens destroyed it, the inhabitants joined in a Castellum Unitum (United Castle) on the hills, whence the current name.
Whatever its origin, Castellaneta was conquered by the Normans in 1064, taken by Duke Robert of Taranto, who expelled its Byzantine inhabitants.
In 1503, during the Italian Wars, the citizens pushed back a French occupation force under the Duke of Nemours, in the so-called "Sack of Castellaneta".
In 1519 the Spaniards sold it to Flemish feudatories, and thenceforth the city started to decline as secondary centre.