Imagine the following situation. I'm a Mac user, if I open a web site with some kind of malware(Platform specific). This site/malware will use my user agent to detect what system I am using. So, if I change my user agent to a Windows one, I will be more secure?
If the site is only using that method to detect your operating system, you'll get a useless Windows .exe.
There are other ways to detect the OS, such as through Adobe Flash APIs, checking the list of system fonts on your system, and likely other things. So it's not foolproof.