I get this question from clients all the time, simply said.. I have no idea. There could be a myriad of reasons for knee pain. The more important question is, "what can I do instead?". Continuing to move and strengthen around that knee, without causing further pain, is going to keep us moving towards the goal.
The lunge is a single leg, knee dominant exercise. Exercises that might cause similar issues are split squats, step ups, single leg squats, Bulgarian split squats, or any exercise where the knees are going forward over the toes.
For most people, I recommend switching to an isometric, or hold. To perform this, the client starts near a wall (for support if needed), taking a large step back (like a lunge), lowering the back knee bringing the body towards the ground. Find a depth that isn't painful, but is difficult, then HOLD and SQUEEZE in that position. The holds will increase the tendon strength as well as muscular strength, familiarize your muscles with deeper ranges of motion, build confidence in that split stance, and increase the ability to balance. By reducing the shearing force (going up and down) on the knee we can normally make things more comfortable.
For more painful cases, I will switch to a single leg, hip dominant exercise. My favorites would be single leg deadlifts and single leg hip lifts. If the client still wants a knee dominant exercise, switch to a two leg, knee dominant exercise (like a body weight squat, or box squat). In the most extreme cases, a wall sit should never go out of style. Low impact, the client can get to a depth that isn't painful, and will still get similar (just less) adaptation to the single leg hold I went over above.