Hello!
It can be commonly due to pain and inflammation due to a fall or injury.
If it is a chronic pain you have to rule out conditions like muscle or tendon injury to your quadriceps or injury to any of the ligaments in the knee. It can be conditions like bursitis or also nerve involvement.
I would suggest you to follow up with an orthopedician for an examination.
Take care!