Most often it's to try and help the other person become a better programmer. I've found that people who have little desire to improve end up sitting there regardless.
The underlying desire to do it, of course, is to give the programmer (the one who we're investing in to improve) a chance to improve. It feels, however, like a wasted effort.