The videos on YouTube are streamed to your computer using Flash, a technique developed by Macromedia that has been bought by Adobe recently. To be able to play flash-modules you need a so called Flash-Player that is installed as sub-module (a so called Plugin) into your webbrowser. In general flash-programs that are played by the Flash-Player is very much restricted in what they can do, so they can't simply read or write your harddrive or do other nasty things. This can be compared to the also existant Java Applets that run in a so called Sandbox.
But like all software the Flash-Player can contain bugs (mistakes done by the programmers or things not thought about, etc.) A hacker can find these bugs and use them for his own benefit. Dependent on the severity of the bug many things can happen. Starting from simply annoying things like the popup of an advertisment even with a popup-blocker being active to more dangerous things like "breaking out" of the beforementioned sandbox.
If a hacker is able to use a bug that way that he can break out the sandbox everything is possible like the reading and writing of the harddrive, or executing programs on the system (outside the browser). These things would allow the installation of trojan horses, viruses or other things.
I don't know of any things like these to be happened recently but it has already happened in the past for Flash, Java or Javascript. All these things are now used very much in every so called Web 2.0 Site where YouTube also is to be seen. So if you want to be on the absolute save side, you should use a dedicated computer for browsing in Internet (this is not a joke). This doesn't necessarily mean that you have to buy new hardware (though that would make things for sure), but you can use the computer-power of current computers to emulate a PC where another operating system is running in. A solution without cost would be the installation of VMWare Player or VMWare Server where you can start another "computer" to be used for you life in Internet. These so called virtual appliances can be set up in a way that they always return to their original state, so even if a bug somewhere allows an evil hacker to install malware on this virtual computer it can only see the virtual system (so nothing of interest residing on your real system) and as soon as you restart the appliance even the malware has vanished (the change only happened inside the memory).
The VMWare-software itself can be downloaded from
http://www.vmware.com/, a freely appliance dedicated for webbrowsing is e.g. available at
http://www.vmware.com/appliances/directory/80. You can also look for other appliances of your interest at
http://www.vmware.com/appliances/directory/
That way you can enjoy webbrowsing with absolutely no fear of your productive system being compromizes. Of course - and every paranoic can confirm - the VMWare Server or Player is only software as well ;-)