KSpyware is (I think) the first open source spyware available on the net.

Why I developped KSpyware?

In order to show how easy spywares can be developped and for fun. Besides, like I stopped to develop virus/worms, I prefer starting to develop spywares and others malwares that don't destroy data.
http://nzeka-labs.com/hacking/KSpyware.htm

Oh.. also, check out this pretty interesting article about Spyware Keyloggers.
http://securityfocus.com/infocus/1829