99.99% of the time, folks get trojans because they gave permission to install them. Either a trojan was embedded in a program that was installed (either from a web site or from an email), or a pop-up on a web site "scanned" your system, said it was infected, and offered an anti-malware program that will remove the malware.