The oversimplified, triple-diluted answer is that they used their Greek names.
But then, with the Question worded as it is, the answer is not justifiably so simple. The breakdown thereof can be approached in two different ways:
From inside the narrative world, in which we assume that the Trojans' depiction in the myths is accurate and thus the basis of what we should understand about them; and
From outside the narrative world, based on deductions of what the
people inhabiting the place supposedly called Troy were actually like "IRL" ("in real life," as they say in video-game parlance) at the time that the Trojan War is supposed to have taken place.
The Timeframe of the Latins and Their Language
The events in question, if they did occur, would have transpired sometime in the 1200s BC. It is highly unlikely that, by then, anyone anywhere in the world was speaking Latin, which comes into any sort of prominence only about 400 years afterwards. In the narrative world there are a few different traditions regarding the tribe of the Latins, whose language would eventually give us the Roman names of the gods. All these traditions point toward a character named Latinos (Λατῖνος), whom the Romans called Latinus.
Logically the language that was named after him should have began to develop no earlier than within his lifetime. In Greek mythology, Latinos' father is either Odysseus (a Greek king who fought in the Trojan War) or Herakles (who lived a generation before the war). One late interpretation (by Ioannes Lydos in the 6th century AD) of Hesiod's Catalogues of Women tries to make Latinos into an earlier figure, saying that he lived not long after the Flood of Deukalion, and that he was in fact the son of Zeus by a daughter of Deukalion, which would have meant he was long dead by the time Troy was under construction.
In the myths, the builders of Troy are essentially Greek colonists who settle in Asia Minor and establish a new kingdom there a short while before the Trojan War. Their culture and religion are, for the most part, indistinguishable from those of their enemies who eventually destroy their kingdom and its stronghold, and they worship the same gods in the same ways with similar priesthoods, rituals and prophecy customs.
Since there would not have been Roman or Latin renditions of anyone's names available for the Trojans' use, the Trojans therefore would have used the Greek names of the gods. This may have changed very gradually after the war, following the migration to Latium of some of the surviving Trojans. In the Deukalionian Flood version in which the Latins have been around just as long as everyone else, the question becomes whether these Latins had so much influence on the shores of the Aegean Sea that the Greek settlers of Asia would have adopted their language for the names of Greek deities in the 13th century BC. Not impossible, but unlikely, and as far as the logic of the story goes, simply not how things were.
Dardanos, His Descendants and Their Religion
There is, however, a Roman tradition about the foundation of Troy which would disagree with what I just said. But let's start with the Greek version of that story. On the island of Samothrake, Elektra, one of the seven Pleiades, bore Zeus a son named Dardanos, who grew up in Arkadia in Greece, where he married a local princess named Khryse. It was during Dardanos' lifetime that Zeus sought to annihilate the human race in Deukalion's Flood. Dardanos escaped the deluge with most of his family, fleeing to his birthplace of Samothrake.
According to Robert Graves' book The Greek Myths, Khryse was a priestess of the "Great Deities," whose images and other paraphernalia she brought with her from Arkadia to Samothrake, where, together with her husband, she introduced the cult of these gods. The two of them decided, however, to keep the names of the gods a sacred secret, thus creating or continuing the practice of Mysteria (Mysteries) in their honour.
While on Samothrake, Dardanos' brother and wife died and he decided to move to Asia, where he took the cult, sacra and mysteria of the otherwise unknown Great Gods with him. The Samothrakian cult in question is thought to have been in honour of gods called the Kabeiroi, whose rites were indeed so secretive that even ancient writers (e.g. Strabo) are wildly unclear as to who exactly they were, speculating that they might be the same as the Korybantes, the Kouretes, or the Daktyloi, who themselves are only slightly less mysterious, and none of whose epithets seem to be from the Greek language.
At any rate, Dardanos built a town, called Dardania, on the slopes of Mt Ida, establishing there at least some aspects of the religion he and his wife had imported from Arkadia to Samothrake. In Asia one divinity who was associated with Dardanos' and Khryse's Great Deities is Kybele (or Kybebe), who in Phrygia was known by the title "Mother of the Gods." Because the Titaness Rhea was the mother of about half of the Twelve Olympians (and grandmother of just about all the rest of them), she thus came to be identified with Kybele, who otherwise does not really have a Greek equivalent.
One image, or a set of images, in particular, supposedly representing the goddess Athena, became an important feature of Dardanos' new settlement. The image or images were called the palladia (or was only a singular palladion), which have/has several conflicting traditions regarding their/its origin.
Dardanos had a grandson named Tros. After him the whole region came to be called Troas. Tros had a son named Ilos who built a city in the neighbourhood of Dardania. He named the city after himself Ilion (which in Latin becomes Ilium), from which we get the word Iliad. But Tros had been so famous that his son's city popularly came be known as Troy while "Ilion" remained as its more poetic title. Ilos brought into his new city the palladion/palladia of his great-grandfather, making it/them a main feature of the city, linked to the preservation of the kingdom. If it/they was/were lost, Troy would fall. Ilos' grandson Priamos would be the city's last king.
The whole point here appears to be that there was an aspect of Trojan religion which was unique and known only to the Trojans (and perhaps Samothrakians too), with gods whose names almost nobody knew, and whose cult is supposed to have been preserved by Tros's descendants the Romans. Between them and the Phrygian Kybele, these may be gods whose names might have been neither Greek nor Roman (even in the narrative world), and if there was something like a Trojan language (whether in the narrative or IRL) then these may have been uniquely Trojan deities with Trojan names.
Certain aspects of Trojan culture are portrayed as distinctively Phrygian, such as the conical Phrygian cap worn by Prince Paris of Troy, and even by his (in)famous Greek lover/abductee Helen.
It would make sense if the Trojans spoke Phrygian, in which language we know the name of at least one god: Dios, the sky-deity whose name corresponds remarkably well to "Zeus," as noted by Herbert Jennings Rose in A Handbook of Greek Mythology. Perhaps the Trojans worshipped Phrygian deities (whose names generally translated easily into Greek?).
Now, back to the Roman tradition that I mentioned earlier: The Italian version of Dardanos is not an Arkadian or Samothrakian but an Etruscan, who migrated from Italy to Phrygia, where he then founded Dardania. He had a brother who moved to Samothrake. When they were parting ways, they divided between them their Penates, family's household gods. The idea here seems to be that Dardanos, originally an Italian, went with his Penates to the place where Troy was founded and his descendant Aeneas eventually brought them back "home" again to Italy. The point here is that thus the Trojans would not have been Greeks (like Dionysios of Halikarnassos insists that they were) but Italians, and hence would have used Etruscan names for the gods.
In Roman mythology, Latinus' father is most commonly identified as the god Faunus, who does not have a neatly direct Greek equivalent. The Trojans who encountered him, then, logically would have had to use the Roman/Latin/Italian name for this deity unless, as was the case in later mythography, they identified Faunus with the Greek Pan and called him by that Greek name.
In the Aeneid there is another Roman god with no Greek equivalent, namely Tiberinus, the personification of the River Tiber. Trojans who knew about him, upon their entry into the region, would also have used his Italian name (unless they simply Hellenised it into Tiberinos).
In "real life" there does seem to have been a great city on the site that Homer and Virgil call Troy. Its real name, the language its people spoke and what their religion was, all seem to be unknown. It would seem that there was something like a Trojan War thereat, or several wars. The Wikipedia article on the Trojan language1 summarises this information really well, mentioning the theory proposed by Calvert Watkins that the language of the city was Luwian.
The Hittite connections made herein imply that the religion and deities of Troy were related to those of the Hittites. There are some very striking parallels between the Hittite Kingship in Heaven myth and the Greek theogonic story of the conflict between the sky-god Ouranos and his sons the Titans, followed by the Titanomachy. The differences, on the other hand, however, are jarring.
The Trojan language article also mentions that the Trojans' allies in the Iliad speak different languages although there is no indication that the Trojans themselves have any trouble communicating with the besieging Greek army.
However, this may merely be evidence that a fictional convention
frequently used in narratives in later times had already been adopted
by the poet of the Iliad: for example, Jason finds no language barrier
with Medea in Colchis, and Trojan Aeneas converses without difficulty
both with Punic Dido and with Latin Turnus.
The Unique Symmetry of Greek and Roman Parallels
To make things even more colourful, in ancient times (long after Homer, however), the Iliad was translated into Latin. In the Latin version everyone (whether Greek or Trojan) uses the Roman names of the gods, and the Roman names of every other character and place too. It appears that there may also have been ancient translations of the Aeneid into Greek, wherein the reverse process would have occurred, all those Italians in Virgil's narrative referring to the gods (and everything else) by their Greek names.
One of the most remarkable and most salient features of ancient Roman religion and mythology is the extent to which they directly copied, virtually wholesale, the stories and characters from Greek religion and myth in order to adapt them to the language and culture of the Romans. No other culture seems to have done this on the scale that the Romans did, except perhaps for their Etruscan ancestors, from whom the Romans may have acquired this cultural borrowing.
Unparalleled Translation and Interpretation Issues
So the Romans had their own version for the name of every single Greek deity, many of them distinctly Latin, like Zeus becoming Iuppiter; and others more obviously copy+pasted, like Apollon becoming Apollo, and Okeanos becoming Oceanus.
As an illustration of how unique this makes the Romans, notice how we, writing in English, cannot perform the same sort of interpretation or translation of these deities into English or even Anglo-Saxon versions. Granted that that is because, for the most part, we don't know enough about the deities of the Angles and Saxons to do that. But say we tried to do this with, for instance, Norse gods as described in the Eddas. It might make for quirky new renditions of the Iliad and the Aeneid that would seem a touch on the absurd side and probably wouldn't make much sense of the original material.
In the Iliad, we could make the mother of Achilles (whatever his name would be in Old Norse) into Dúfa, one of the nine daughters of the giant sea-god Ægir. Out of the nine, Dúfa's name is the closest I could (arbitrarily) get to the Greco-Roman Thetis, which is the actual name of Achilles' mother in the original myths. Thetis' father is indeed a giant sea-god named Nereus, and that's basically where the parallel ends, since Nereus has fifty daughters, not just nine, and he lives in the Mediterranean Sea rather than on an island in northern Europe.
In the Aeneid, Aeneas (Old Norse equivalent file not found) could become the son of the goddess Freyja, which perhaps would be less discrepant than the identification of Dúfa with Thetis. Both Venus (Aeneas' actual mother in the Aeneid) and Freyja are associated with birds, and both drive chariots drawn by animals not usually used for such a job, but Freyja's association with sorcery is much more intense than any link that Venus might have with the practice thereof.
The point is that even we in English use either the Greek or the Roman versions of the names of these characters. And between the two versions, they are so interchangeable that we could have an English translation of the Iliad with Roman names or of the Aeneid with Greek names without at all impeding the narratives.
1. Brought to my attention courtesy of Spencer, a fellow Mythology StackExchange user.