North Carolina produced almost all of America's tar. It was somewhat derogatory until the Civil War, when the North Carolina units became known for not retreating or surrendering... when it became time to retreat, they fought as if their feet were stuck in tar. The nickname "Tar Heel" holds a lot of pride for native North Carolinians.
I can see how people from outside of North Carolina would think Tar Heel is a lousy mascot name, but it has a really cool history and is the source of a lot of pride.