In my experience, knee pain can be caused by several factors:
-- Saddle too low or otherwise improperly situated (but usually too low).
-- Mashing big gears rather than spinning.
-- Starting out pedaling too hard on rides without warming up sufficiently.
Like others said, get your chain fixed so you can shift properly. Make sure your saddle is the right height. Learn to spin.