Many factors could have led the knee pain. You need to find out the problem from a Physiotherapist, get it treated. While treatment is on, avoid heavy weight lifting in the gym as per your physio’s advice. Once proper strengthening of muscles has been started, pain has subsided, your physio shall analyse your postures & form & then gradually you can start heavy training (if you do it). You can consult with me online.
Treatment will be provided according to the assessment done by the Physiotherapist. Exercises should be include on your daily routine to reduce the pain and improve the mobility of the body movements. Proper diet and plenty of water should be consumed. Maintain weight and body posture.