Java is a type of programming language. Your web browser needs to have something called the Java Runtime Environment (JRE) installed in order to be able run any programs written in the Java language.
You can download the latest Java JRE from this web site:
http://www.java.com
Some web sites use little programs called Java applets to perform certain tasks, this could be a graphical interface for example or performing something more complex. In order for those applets to work properly you need to have the JRE installed. It does not usually come included with Windows.
If your computer is asking you to update Java then it usually means you already have it installed. You can tell by looking in your Add/Remove programs control panel (Programs and Features in Vista and later) and look for Java listed there. If it is already there you have it installed already.
Java releases updates every few months and just like any software on your computer that runs in the web browser, it is important to keep it up to date. The latest version will fix any bugs or security issues that might be present.
The current version of Java is version 6 Update 17 (or 1.6.17 for short).
You can test what version you have installed at this web site:
http://www.java.com/en/download/help/testvm.xml
If you don't have the latest one then you are recommended to download it.
Java should not affect YouTube as YouTube does not use Java. YouTube uses a different kind of technology called Adobe Flash and it's likely that if you installed Flash you may have affected YouTube.
Java is not associated with YouTube.