It is very rare that a trojan or virus appears on the Apple Mac, however it can happen. The current one doing the rounds and heavily reported is Flashback.
If you visit a malicious website using your browser it will attempt to run Java code to exploit a weakness in the Java library. If successful your Mac will have a trojan installed — watching for certain activity in an attempt to gather usernames and passwords; you may also be redirected to malicious sites.
Oracle closed the weakness in their Java libraries some months ago, however Apple do not use the standard Java runtime and prefer to offer their own incarnation — It is fair to say Apple were too slow in fixing this.
Apple have now released a Java update, available via your ‘Software Update’ in the system preferences — this will fix the vulnerability.
It is worth checking you are not one of the 600,000 users worldwide to be infected. There are a few things to check using the Terminal App, however Juan Leon has written a handy little Applescript to do the work for you. Pop over to github and download the script — this will check if you are infected with the Flashback trojan. Only takes a few seconds to do, so do it now!
On a side note, many newer Macs do not have Java installed by default as Apple see it as old and insecure technology — an interesting thought!