Why doesn't hair tangle?
First of all, long hair certainly does get tangled. If you've ever had long hair, you'll know that combing out knots can be a real pain and will often result in serious fraying, tearing, and split ends.
That said,there are two major distinguishing factors between your hair and your head phones: length and number of ends.
First, your hair is much shorter. Even people with very long hair will usually have nowhere near the length of a pair of earbuds. The longer a collection of strands is, the more freedom the strands have to bend and twist around one another. And, like with the phonebook effect, at a certain point there will be such a significant area of contact that friction will begin to bind the strands.
Second, your standard pair of earbuds has 2 or three free ends (depending on whether or not they are unplugged). But your hair only ever has one free end. This constraint on your hair strongly limits its configuration space. There are many fewer configurations that your hair can take since it only has one free end with which to attempt to develop knots. This means that until the hair gets very long, there is a very small chance that it will knot itself.
For your hair to form a knot (more or less) spontaneously, it needs to double back on itself twice - once to make the loop and once to thread itself through the loop. This means that hair will not knot until it has some certain minimum length related to its stiffness and bulk friction. Moreover, a long headphone wire is much more likely to knot itself since it has two (or three) free ends which can twist independently around one another to spontaneously form a knot.
Hair is stiff.
Contrary to what the question states, a strand of hair is rather stiff. The average hair thickness is about 75$\,\mu$m, and you can hold horizontally by one end a strand about a thousand times this value in length (~5$\,$cm). See Shape of a Ponytail and the Statistical Physics of Hair Fiber Bundles. That means that an equally stiff earbud cord, which has a diameter of about 2$\,$mm at least, would be able to withstand its own weight in a horizontal position at a length of about one meter.
Also, as Geoffrey's answer points out, differently from earbuds, one end of the hair strand is fixed, attached to the head, which is an important constraint.