Hi and welcome.
Headaches after tooth filling is most likely due to irritation and inflammation of the nerve inside the tooth which causes lots of pain and headache along its path.But as you said its been 3 weeks since filling this headache and inflammation should get settle by now. I would suggest you to followup with your dentist as that nerve is still inflammed or irritated and need to be fixed. Meanwhile you can take ibuprofen for pain and headache and it would decrease inflammation as well.
Let me know if you have further questions.
.Please do not forget to leave a positive rating by clicking on stars on top right corner.
Wish you good health