If there are spyware or viruses on your computer your password was keylogged. If you have very simple password, say one short word without numbers that has relevance to your username, then that will be easy to crack. I'm not sure how else a hacker would have been able to breach your account, maybe your house was unlocked, someone strolled in, opened your browser to find your Facebook home page still logged in, etc?