The most probable cause for this may be an injury
to the pre-patellar bursa. It can be due to injuries to other bursa around the knee too.
Keep ice packs locally to the affected area for about 20 minutes twice daily for a few days.
You can take simple analgesics like Acetaminophen
which is available over the counter twice daily after food.
Give adequate rest for 2 days. Do not exert yourself physically.
Get well soon.