A Trojan is named after the Trojan horse, which was a stratagem used in an ancient war between Greece and Troy. The Greeks were unsuccessful in their siege of Troy, so they built a wooden horse and left it outside the city. They then packed up and embarked on their ships to sail away from Troy.
The Trojans believed that the Greeks had forfeited the siege and and left the horse as a tribute. So, they wheeled the horse inside and proceeded to hold a festival to celebrate their victory. Little did they know that a cadre of Greek soldiers had hidden themselves within the horse. These soldiers waited until nightfall to exit the horse and open the gates for the returning Greek army, ending the Trojan War.
In cyber security a Trojan is a piece of malware that hides itself within a legitimate piece of software, much like that Trojan horse. The legitimate software works as intended and the malware activates when that software is executed.