The Trojan Horse is a story from the Trojan War about the subterfuge that the Greeks used to enter the independent city of Troy and win the war. There is no Trojan Horse in the original poems by Homer about the Trojan War, and the conclusion of the story is marked by the retrieval of Hector's corpse (a great Trojan hero) by his father, Priam (king of Troy), from the willing hands of Achilles (the Greek general), though under the watchful and disagreeable eye of Agamemnon (the Greek king); the implication is that the Trojan War ended in amicable peace.
But in the popularized, fictional work of the Aeneid by Virgil, after a fruitless 10-year siege, the Greeks at the behest of Odysseus constructed a huge wooden horse and hid a select force of men inside, including Odysseus himself. The Greeks pretended to sail away, and the Trojans pulled the horse into their city as a victory trophy. That night the Greek force crept out of the horse and opened the gates for the rest of the Greek army, which had sailed back under cover of night. The Greeks entered and destroyed the city of Troy, ending the war.
Metaphorically, a "Trojan horse" has come to mean any trick or stratagem that causes a target to invite a foe into a securely protected bastion or place. A malicious computer program that tricks users into willingly running it is also called a "Trojan horse" or simply a "Trojan".
The main ancient source for the story is the Aeneid of Virgil, a Latin epic poem from the time of Augustus. The event is also referred to in Homer's Odyssey. In the Greek tradition, the horse is called the "wooden horse" (δουράτεος ἵππος douráteos híppos in Homeric/Ionic Greek (Odyssey 8.512); δούρειος ἵππος, doúreios híppos in Attic Greek).