Nowadays almost all civilian and military vessel have a name. Was this so in the antiquity, did the ships of Athens, Carthage or Rome have formal individual names?
Xenophon in his Hellenica (an account of the last yearsof the Peloponessian War and its aftermath) mentions several named ships, for example, "Paralus" and "Salaminia". Thus, we can infer that at least some of Greek ships were named in IV century BC, and maybe earlier. Also, Homer in his Iliad, which is dated to 8th century BC, does not give any names for any of numerous Achaean ships - that might be just a coincidence, but also may point to the tradition of giving ships names emerging later.
As for the Romans - again, this is circumstantial evidence, but Aeneas ships' in the "Aeneid" all have names, so we can argue that by 20 BC Roman ships at least sometimes were given names.
The idea of naming ships goes back several thousand years but, unsurprisingly, there is very little evidence from the earliest days of sailing.
Possibly the earliest evidence of an individual ship name is the vessel Praise of the Two Lands,
a large Egyptian vessel made of cedar wood, built ca. 2680 B.C.
Source: Anita Schybergson, 'Cognitive Systems in the Naming of Finnish Ships'. In Carole Hough & Daria Izdebska (eds), '‘Names and Their Environment’: Proceedings of the 25th International Congress of Onomastic Sciences, Volume 5' (2014)
'Two lands' probably refers to Lower and Upper Egypt.
If we accept names from mythology, then we might consider the Ancient Egyptian god Ra's solar barque, the Atet, which was known by two names:
The solar barque the people saw during the day was called the Mandjet, and the one which navigated through the underworld was known as the Meseket.
Other evidence from the time of the Old Kingdom only seems to indicate what we now term classes of ships. For example, Henet-ships and Shabet-ships were two kinds of funerary boats, and there does not seem to be any evidence of these having names: in the tomb of Seneb, the inscriptions simply state '"rowing in a Shabet-ship" and "sailing in a Henetboat". Even the name of the well-preserved 'Khufu ship' is unknown, assuming that it even had one (but there is evidence from the New Kingdom, as shown in user91876's post).
From Ancient Greece, Ships and Seamanship in the Ancient World by Lionel Casson mentions that very few ship names are known before the end of the 5th century BC, but
...from 377-322 BC, the Athenian naval lists preserve about 300 names given to galleys in the fleet.
Among the names mentioned are
Aktis, Anysis,... Eucharis,...Hikane,...Prote,...Salpinx
Among the favourite names were 'Nike' and names which referred to a ship's ability and 'sureness to succeed'. Geographical and animal names were also used, as well as deities, adjectives ('golden') and abstract nouns. These names were mostly given to triremes, a few to quadriremes
"Fleet of triremes made up of photographs of the modern full-sized replica Olympias" Source: https://upload.wikimedia.org/wikipedia/commons/d/df/Greek_Galleys.jpg
For the Hellenistic period we know much less but there is the Syracusia which
was probably the largest transport ship of antiquity build after an order of Hieron II, king of Syracuse, by Archias of Corinth around 240 BC, later it was given as a gift to Ptolemy III Euergetes of Alexandria and it was renamed to Alexandria (or Alexandris). Designed by Archimedes. Used a variant of his screw to pull the unfinished ship into the sea where the work was completed.
Source: gcaptain via Wikipedia An exaggerated depiction of the Syracusia from 1798
Casson says that the sources for ships names are 'much richer' for Ancient Rome. Details are given in Chapter 15 of Ships and Seamanship. In another book, The Ancient Mariners, Casson says that
A Roman man-of-war was given a name but it was not inscribed on the hull as today. Instead an illustrative carving was set on the bows, for example, a relief of a god if the ship was called after one
He also notes that, for names, there was
an understandable preference for deities of the sea like Neptune, Nereis, Triton, or for such sailors' favorites as Isis and Castor and Pollux. A number of ships bore geographical names, and here there was a tendency, natural enough, to go in for rivers; at one time or another all the great rivers of the ancient world, the Tigris, Euphrates, Nile, and Danube, were represented in the fleets. But quite a few were named after abstract qualities, and the fact that it was a peacetime navy seems reflected in the choice: names such as Triumphus or Victoria are rare; the christeners preferred Concordia^ lustitia, Libertas, Pax, Pietas, and the like.