Who knows why guys do the things they do. He may have been doing it to look cool in front of his friends, or he may have been doing it to try and hurt you, or possibly a little bit of both. To be honest, though, why he did it does not matter very much - because what's done is done. You should be more concerned with how you are going to handle this situation now that's it's over. The best thing you can do is not let it get too much to you, because these types of rumors will be spread around constantly in high school. It's all part of the game that young kids play - and when it comes to sexual subjects, young guys seem to play them the most. Let this roll off your back like all the other senseless drama starters you've no doubt avoided before.
However, don't let him get away with this. Friends don't do this type of stuff to friends, so you need to make him aware that you're not going to put up with that type of stuff, and that you don't appreciate him saying these types of things to you. How far you want to take this is up to you - but something definitely needs to be said.
If you're offended enough by his rumor spreading, this ending the friendship may come into play. If it has went further than that, meaning kids at school won't let it drop, you might want to consider going to the principal or some other authority figure - something more serious may need to be done.
No matter what you decide, don't let him think this is okay. At least talk to him, and ask him how he would feel if someone spread some senseless rumor about him that he was personally bothered by. Make him put himself in your shoes, so he can understand that even if he does something as a joke, it can have a long lasting impact.