When you take a colored scarf and fold it into a triangle, then tie it onto your head, that's what was called a do rag in the South. I had always thought that the name comes from the fact that you usually did this prior to performing some sort of work. It is a very logical way to keep the sun off your head if the wind is blowing too hard to keep a hat on. It is also very logical to keep the sweat from pouring down into your eyes.
Currently made popular by the urban street gangs.