Which Languages?
There is good reason to think that, as far as the myths are concerned, the Trojans probably did speak the same language as the Achaeans. At the foundation of Carthage its primary language would have been Phoenician.
There is a lot of traffic described between Greece and Troy going as far back as the time of the Flood, since the founders of Troy are supposed to have been descendants of Dardanus, a son of Zeus who survived the Flood and migrated from Greece to Asia Minor, where Troy was built by his great-grandson Ilus.
Troy does have an African connection: two of Aeneas' relatives, the brothers Emathion and Memnon (nephews of Priam, and third cousins of Aeneas), are both said to have been kings of Ethiopia. Emathion dies a generation before the Trojan War, slain by Hercules/Herakles, while Memnon brings his army, augmented by forces from Persia, to support his uncle Priam against the Greeks.
No other member of the family seems to be as directly connected to Africa as that, however, and the ancient Ethiopia spoken of by the Greeks (= modern East African Sudan) is quite some distance to the southeast of Carthage. It also doesn't mean that Aeneas himself automatically spoke the language of the Ethiopians, not that this should help at all in communicating with a Phoenician.
Very Seldom Are Language Differences a Main Focus
In Homer's Iliad, which you reference in your Question regarding Greek vs. Roman names at Troy, no communication difficulty is indicated as existing between the Greeks and the Trojans, and, as noted in my Answer to that Question, the implication even seems to be that the Trojans are ethnically Greek, speak the Greek language and worship the same Greek deities as their opponents from across the Aegean Sea.
Meanwhile IRL, "in real life," whoever it is that inhabited the site mythically called Troy probably did have their own language, perhaps related to or the same as Phrygian or Hittite, as well as their own religion, which may or may not have had closer parallels with Greek and/or with Asian veneration of deities.
In similarity to the Iliad, Virgil's Aeneid does not indicate any lingual communication difficulty between the Trojans and the Carthaginians. But this is a typical writing convention particularly in ancient forms of literature, which feature characters from various parts of the world interacting with each other often without the question of language ever being brought up.
If it ever does come up then it is almost always because it directly affects the plot of the story rather than it being merely descriptive detail filler. The author assumes that the reader understands that different peoples, tribes and nations speak different languages and that therefore they must either be multilingual (or have to learn fairly quickly), or have translators handy.
Greco-Roman mythology is chock-full of such examples of international and inter-tribal communications in which it is never explained which language anyone is speaking nor is it mentioned that there are any language barriers. Stories which include such events are quite the special case. Instead we typically have stuff like the great hero Hercules/Herakles travelling to every country in the world, as far as the Romans and Greeks were aware at the time, but no one says that he necessarily spoke more than one language or needed special help communicating, say, with the kings of Egypt, Ethiopia and Troy, or with the queen of the Amazons, or the Libyan giant Antaeus, or with Hades' herdsman Menoetes, etc.
Many Other Languages Implied in Dido's Story
There are also several international meetups in the story of Dido. In her time, since she is supposed to have built Carthage, the city's language would simply have been her native Phoenician. But she does encounter the locals, who are not Phoenician, when she first arrives in Africa, these including the Numidians and Gaetulians, as well as people from the Greek colony of Barca in Libya, which is about a day's walk from Cyrene, another Greek colony in the same country.
Quite an influential character in the Aeneid is the Numidian king Iarbas, who is also described as Gaetulian and whom Virgil tells us is the son of Hammon, the Libyan Jupiter, by a Garamantian nymph. The Garamantes were Berbers like the Numidians and the Gaetulians. Iarbas proposes marriage to Dido but is rejected, and his prayer to Hammon causes the god to send Aeneas back out of Africa. So here we already have an African character from a considerable number of different backgrounds, and we can only assume which ancient Berber language he spoke and whether he conversed with Dido in his own tongue or in Phoenician.
Most Greek and Roman mythographers say that Troy, like Barca and Cyrene, was a Greek colony. Some Roman writers say that it was an Etruscan colony. These writers probably imagined that the Trojans spoke Greek or some Italian language, although after generations in Asia, it certainly wouldn't be unreasonable to assume that they either formed their own dialect or were assimilated into the local cultures and spoke an Asian language.
Since Carthage was still under construction when Aeneas met Dido, there wouldn't have been any major trade deals going on between this city and Troy. For the purposes of the question, the commerce would have needed to be between Troy and Phoenicia, the latter of which Dido came from.
Going by this Wikipedia map indicating Phoenician trade routes, Troy does not come anywhere near being a participant. It would be located on the northeastern shore of the Aegean, quite some distance north of Crete Island, Crete being the easterly end of the route.
So what language Aeneas spoke (whether Greek, Trojan, Phrygian, Hittite or something else, assuming that Troy even existed in any form close to its mythical description) and whether he conversed with Dido and the Carthaginians in their native Phoenician, or if Dido knew Aeneas' language, or whether they employed the use of translators, is purely a matter of speculation with which the storytellers do not engage us.
The question of trading partners may be the one easiest to eliminate as an option, although that would not have been the only way for a Phoenician to learn "Trojan" or vice versa. It is also not impossible that Troy might have had its own business enterprises which reached up to Phoenicia, which after all is closer to Troy than Carthage is.