I have a bad ankle/foot that is causing me trouble when I run so I switched to cycling. I never had knee problems when running but I now get knee pain from cycling...
It could be an issue with your position (seat too high, too low, cranks too long, if you are using clipless pedals maybe need to get wider stance, ...). I would get a professional bike fit.