The founding of Barcelona is the subject of two different legends. The first attributes the founding of the city to the mythological Hercules. The second legend attributes the foundation of the city directly to the historical Carthaginian Hamilcar Barca, father of Hannibal, who named the city Barcino after his family in the 3rd century BC.
In about 15 BC, the Romans redrew the town as a castrum (Roman military camp) centred on the "Mons Taber", a little hill near the contemporary city hall (Plaça de Sant Jaume). Under the Romans, it was a colony with the surname of Faventia, or, in full, Colonia Faventia Julia Augusta Pia Barcino or Colonia Julia Augusta Faventia Paterna Barcino. mentions it among the small towns of the district, probably as it was eclipsed by its neighbour Tarraco (modern Tarragona), but it may be gathered from later writers that it gradually grew in wealth and consequence, favoured as it was with a beautiful situation and an excellent harbour. It enjoyed immunity from imperial burdens.The city minted its own coins; some from the era of Galba survive.
Some important Roman ruins are exposed under the Plaça del Rei, its entrance located by the city museum (Museu d'Història de la Ciutat); the typically Roman grid plan is still visible today in the layout of the historical centre, the Barri Gòtic ("Gothic Quarter"). Some remaining fragments of the Roman walls have been incorporated into the cathedral. The cathedral, also known as the Basilica La Seu, is said to have been founded in 343. The city was conquered by the Visigoths in the early 5th century, becoming for a few years the capital of all Hispania. After being conquered by the Arabs in the early 8th century, it was reconquered in 801 by Charlemagne's son Louis, who made Barcelona the seat of the Carolingian "Hispanic March" (Marca Hispanica), a buffer zone ruled by the Count of Barcelona.
The Counts of Barcelona became increasingly independent and expanded their territory to include all of Catalonia. In 1137, Aragon and the County of Barcelona merged in dynastic union by the marriage of Ramon Berenguer IV and Petronilla of Aragon, their titles finally borne by only one person when their son Alfonso II of Aragon ascended to the throne in 1162. His territories were later to be known as the Crown of Aragon, which conquered many overseas possessions and ruled the western Mediterranean Sea with outlying territories in Naples and Sicily and as far as Athens in the 13th century. The forging of a dynastic link between the Crowns of Aragon and Castile marked the beginning of Barcelona's decline. The Bank of Barcelona, probably the oldest public bank in Europe, was established by the city magistrates in 1401. It originated from necessities of the state, as did as the Bank of Venice (1402) and the Bank of Genoa (1407).