der Kopfschmerz
headache
A sensation of pain in the head area. In German, it is more commonly used in the plural (Kopfschmerzen).
Nach der langen Autofahrt hatte ich einen leichten Kopfschmerz.
After the long car ride, I had a mild headache.

headache
Loading your saved state.
headache
A sensation of pain in the head area. In German, it is more commonly used in the plural (Kopfschmerzen).
Nach der langen Autofahrt hatte ich einen leichten Kopfschmerz.
After the long car ride, I had a mild headache.

The word is built very logically: it consists of 'der Kopf' (head) and 'der Schmerz' (pain). So it literally means 'pain in the head'.
Lärm kann starke Kopfschmerzen verursachen.
Noise can cause severe headaches.
Even if you only have one pain in your head, German almost always uses the plural 'Kopfschmerzen' (headaches). The typical phrasing is 'Ich habe Kopfschmerzen' (I have a headache/headaches).
Ich habe seit heute Morgen starke Kopfschmerzen.
I have had a bad headache since this morning.
In the figurative meaning, the fixed expression 'jemandem (Dativ) Kopfschmerzen bereiten' or 'jemandem Kopfschmerzen machen' is used. It means that something causes worries or problems.
Die steigenden Kosten bereiten der Firma Kopfschmerzen.
The rising costs are causing the company headaches.
problem
'das Problem' and 'Kopfschmerzen' can both figuratively stand for worries or difficulties. 'Problem' is the normal, direct word. 'Kopfschmerzen' is often used in the expression 'jemandem Kopfschmerzen bereiten' (to cause someone headaches). Then it is not about real pain in the head, but about something causing worry or being hard to solve. 'Problem' is almost always neutral and appropriate. 'Kopfschmerzen bereiten' sounds more figurative and emphasizes more strongly that something is burdensome or annoying.

Die hohen Energiekosten bereiten vielen Familien Kopfschmerzen.
The high energy costs are causing many families headaches.
Heute ist mein größtes Problem, dass der Computer nicht startet.
Today my biggest problem is that the computer will not start.