HEAD
HEAD is a special reference in Git that points to the current commit you have checked out. Normally, when you are on a branch, HEAD points to the latest commit on that branch. When you make a new commit, HEAD moves forward automatically to point to that new commit. When you reset the branch to a different commit, HEAD moves accordingly.
It's similar to the concept of current directory in the terminal. Just as the current directory indicates where you are in the filesystem, HEAD indicates where you are in the commit history of your repository.
Having current commit is needed to know what files to show in your working directory, where to add new commits, with what to compare changes, and so on.
Detached HEAD
If there was a prize for having the worst possible name for a concept, detached HEAD would be a winner. It gives the vibes of something broken or dangerous, while in reality it's a benign state that you can use for various purposes.
Oh, I'm in the detached HEAD state! I must have broken my entire repository!
Let me use another metaphor to explain what detached HEAD really means.
Think of a western movie: scorching heat, people laying train tracks (branches) across the desert. New towns (your commits) pop up along the track as the work progresses. You can visit any of those towns by traveling back and forth along the track.
Now suppose there used to be a track leading to an old, abandoned town. The track may be gone (the branch was deleted), but the town still exists (Git keeps all commits).
Since there are no tracks leading to that old town, you can only reach it by walking there off the track (checking out the commit via its hash). Once you arrive, you're in the detached HEAD state.
In this state, you can explore the town—look around, compare things, review history. Old towns like this are usually abandoned for a reason, so there's not much to do. However, you can still build from here: start new tracks (create a new branch) from that old town. You can even build a new town (new commit), but it will remain isolated unless you create a new track (new branch) first.