What causes string buzz at the nut?
Buzz right at the headstock end, especially on open strings, points to one place: the nut. It's a small piece of bone or plastic, but when its slots are cut wrong, it causes an outsized amount of noise for its size.
The core issue
Nut slots need to be cut to a specific depth and angle for each string. Too shallow (too high), and the string sits too far above the first fret — not a buzz problem, but a playability one. Too deep, and the string sits close enough to the first fret that it buzzes against it when played open, because there's not enough clearance for the string to vibrate without touching metal it shouldn't.
How to tell it's the nut and not something else
Buzz that happens on open strings but clears up once you fret past the first couple of frets is a strong signal it's a nut issue, not a general action or relief problem. If the buzz persists as you go up the neck, look elsewhere — the nut isn't in play once you're fretting past it.
The fix
Usually a nut slot recut, or in worse cases, a full nut replacement if the slots have been cut too low to be corrected safely. This isn't really a DIY-with-a-nail-file situation if you want it done properly — the tolerances are tiny, and there's no adding material back once you've filed too much away, short of shimming or a new nut entirely.
If your open strings buzz but everything higher up the neck is clean, that's a quick, inexpensive fix. Don't let it linger and convince you the whole guitar needs work.