First of all, there are many different security and safety aspects. In some of them, Windows is more secure than Linux, while in others, less secure.
As for the past, Windows is well known for its hundreds or even thousands of security bugs in last 20 years. However, this is just the past. Microsoft since 2003 tries to improve security skills in their teams and make each new Windows edition more and more secure.
As for Ubuntu - it's a clone of Debian, which is generally secure by default. However there are a few key differences between Debian and Ubuntu: Ubuntu is configured in a different manner, to be more simple to learn and use for ordinary users, than Debian.
This enforces some security implications:
Ubuntu has newer, less tested packages, with possible new, not yet spotted bugs (while Debian has at least 1-year old, "frozen" packages, with only security and other major bugs fixed)
Ubuntu has PPA user-mode repositories - it's easier to accidentally install rogue software through PPA than through traditional Debian repositories
Ubuntu has less strict package maintaining process - search for ownCloud maintainer problems, or Sun Java problems
Ubuntu desktop install several custom movie-watching-related software, that is not covered by security team, furthermore, localized versions (at least Polish version) install even more such software
Ubuntu sudo configuration allows possible rogue software to catch only the user's password to gain root privileges (no separate root password, like in classic Linux systems)
If you're looking for more secure alternative to Ubuntu, you should try Debian.