In November 2009 Google introduced auto-captions for videos on YouTube, but it's not always accurate, leading to frustrating (and sometimes funny) errors. This interesting article from Scientific American takes a look at how Google is working to improve the technology; Google says they've reduced 20% of errors in their latest update.
While Google is working hard and I love having the option for auto captions, I don't think auto captions should be used in place of regularly captioning your videos. Sometimes auto captioning can fail and fail spectacularly - if I were putting a video on YouTube I would not want to rely on auto captions to accurately transcribe what is said.
Here are the directions for adding captions/subtitles to a YouTube video. Universal Subtitles is also a great way to provide subtitles in all languages for videos that aren't captioned yet.