The factors that cause your knee to hurt are complex, and despite a lot of research are currently not completely clear. However, the infographic below helps to explain the most likely reasons.
Dye 2005. The pathophysiology of patellofemoral pain: a tissue homeostasis perspective.
Maclachlan 2017. The psychological features of patellofemoral pain: a systematic review.