In the context of computing and software, a Trojan horse, or simply trojan, is a piece of software which appears to perform a certain action but in fact performs another such as a computer virus.
Contrary to popular belief, this action, usually encoded in a hidden payload, may or may not be actually malicious, but Trojan horses are notorious today for their use in the installation of backdoor programs.
Simply put, a Trojan horse is not a computer virus in most cases. Unlike such malware, it does not propagate by self-replication but relies heavily on the exploitation of an end-user (see Social engineering).
It is instead a categorical attribute which can encompass many different forms of codes. Therefore, a computer worm or virus may be a Trojan horse.
The term is derived from the classical myth of the Trojan Horse.
Read more here