The exact etymology of the nickname is unknown, but most folklore believe its roots come from the fact that tar, pitch, and turpentine created from the vast pine forests were some of North Carolina's most important exports early in the state's history. For a time after the American Civil War, the name Tar Heel was originally derogatory, but it was later reappropriated by the people of North Carolina.  Because the exact history of the term is unknown, a number of legends have developed to explain it. One such legend claims it to be a nickname given during the U.S. Civil War, because of the state's importance on the Confederate side, and the fact that the troops "stuck to their ranks like they had tar on their heels".  The term "Tar Heel" gained popularity during the Civil War. 
In its early years as a colony, North Carolina settlements became an important source of the naval stores tar, pitch, and turpentine, especially for the British navy. Tar and pitch were largely used to paint the bottom of wooden British ships both to seal the ship and to prevent shipworms from damaging the hull. 
At one time, an estimated 100,000 barrels (16,000 m3) of tar and pitch were shipped annually to England.  After 1824, North Carolina became the leader in the United States for naval stores.  By the Civil War, North Carolina had more than 1600 turpentine distilleries, and two thirds of all turpentine in the United States came from North Carolina and one-half from the counties of Bladen and New Hanover. 
Historians Hugh Lefler and Albert Newsome claim in North Carolina: the History of a Southern State (3rd edition, 1973) that North Carolina led the world in production of naval stores from about 1720 to 1870. 
At the time, tar was created by piling up pine logs and burning them until hot oil seeped out from a spout. The vast production of tar from North Carolina led many, including Walt Whitman, to give the derisive nickname of "Tarboilers" to the residents of North Carolina.  North Carolina was nicknamed the "Tar and Turpentine State" because of this industry. 
Somehow, these terms evolved until the nickname Tar Heel was used to refer to residents of North Carolina and gained prominence during the American Civil War. During this time, the nickname Tar Heel was a pejorative, but starting around 1865, the term began to be used as a source of pride. 
In 1893, the students of the University of North Carolina founded a newspaper and named it The Tar Heel, which was later renamed The Daily Tar Heel.  By the early 1900s the term was embraced by many as a non-derisive term for North Carolinians by those from inside and outside the state of North Carolina. 
The following legends and anecdotes have arisen trying to explain the history of the term Tar Heel.
According to this legend, the troops of British General Cornwallis during the American Revolutionary War were fording what is now known as the Tar River between Rocky Mount and Battleboro when they discovered that tar had been dumped into the stream to impede the crossing of British soldiers. When they finally got across the river, they found their feet completely black with tar. Thus, the soldiers observed that anyone who waded through North Carolina rivers would acquire "tar heels." 
In the third volume of Walter Clark's Histories of the Several Regiments from North Carolina in the Great War, the author explains that the nickname came about when North Carolina troops held their ground during a battle in Virginia during the American Civil War while other supporting troops retreated. After the battle, supporting troops asked the victorious North Carolinians: "Any more tar down in the Old North State, boys?" and they replied: "No, not a bit; old Jeff's bought it all up." The supporting troops continued: "Is that so? What is he going to do with it?" The North Carolinian troops' response: "He is going to put it on you'ns' heels to make you stick better in the next fight." 
The State of North Carolina was the next to last state to secede from the United States of America, and as a result the state was nicknamed "the reluctant state" by others in the south. The joke circulating around at the beginning of the war went something like: "Got any tar?" "No, Jeff Davis has bought it all." "What for?" "To put on you fellows' heels to make you stick." As the war continued, many North Carolinian troops developed smart replies to this term of ridicule: The 4th Texas Infantry lost its flag at Sharpsburg. As they were passing by the 6th North Carolina a few days afterward, the Texans called out, "Tar Heels!", and the reply was, "If'n you had had some tar on your heels, you would have brought your flag back from Sharpsburg." 
The book Grandfather Tales of North Carolina History (1901) states that:
During the late unhappy war between the States it [North Carolina] was sometimes called the "Tar-heel State," because tar was made in the State, and because in battle the soldiers of North Carolina stuck to their bloody work as if they had tar on their heels, and when General Lee said, "God bless the Tar-heel boys," they took the name. (p. 6) 
A letter found in 1991 (dating from 1864 in the North Carolina "Tar Heel Collection") by North Carolina State Archivist David Olson supports the theory that Lee might have stated something similar to this. A Colonel Joseph Engelhard, describing the Battle of Ream's Station in Virginia, wrote: "It was a 'Tar Heel' fight, and ... we got Gen'l Lee to thanking God, which you know means something brilliant."  
- The earliest surviving written use of the term can be found in the diary of 2nd Lieutenant Jackson B. A. Lowrance, who wrote the following on February 6, 1863 while in Pender County, southeastern North Carolina: "I know now what is meant by the Piney Woods of North Carolina and the idea occurs to me that it is no wonder we are called 'Tar Heels'." 
- After the Battle of Murfreesboro in Tennessee in early January 1863, John S. Preston of Columbia, S.C., the commanding general, rode along the fighting line commending his troops. Before the 60th Regiment from North Carolina, Preston praised them for advancing farther than he had anticipated, concluding with: "This is your first battle of any consequence, I believe. Indeed, you Tar Heels have done well." 
- An August 1869 article in Overland Monthly magazine recounted an anecdote regarding "a brigade of North Carolinians, who, in one of the great battles (Chancellorsville, if I remember correctly) failed to hold a certain hill, and were laughed at by the Mississippians for having forgotten to tar their heels that morning. Hence originated their cant name 'Tarheels'." 
- In a letter dated 1864 (in the North Carolina "Tar Heel Collection"), a Colonel Joseph Engelhard described the Battle of Ream's Station in Virginia. In it, he states: "It was a 'Tar Heel' fight, and ... we got Gen'l Lee to thanking God, which you know means something brilliant". 
- North Carolina State Governor Vance said in one of his speeches to the troops: "I do not know what to call you fellows. I cannot say fellow soldiers, because I am not a soldier, nor fellow citizens, because we do not live in this state; so I have concluded to call you fellows Tar Heels. "
- A piece of sheet music, "Wearin' of the Grey", identified as "Written by Tar Heel" and published in Baltimore in 1866, is probably the earliest printed use of Tar Heel.  
- On New Year's Day, 1868, Stephen Powers set out from Raleigh on a walking tour that, in part, would trace in reverse the march of Gen. William T. Sherman at the end of the Civil War. As a part of his report on North Carolina, Powers described the pine woods of the state and the making of turpentine. Having entered South Carolina, he recorded in his 1872 book, Afoot & Alone, that he spent the night "with a young man, whose family were away, leaving him all alone in a great mansion. He had been a cavalry sergeant, wore his hat on the side of his head, and had an exceedingly confidential manner." "You see, sir, the Tar‑heels haven't no sense to spare," Powers quotes the sergeant as saying. "Down there in the pines the sun don't more'n half bake their heads. We always had to show 'em whar the Yankees was, or they'd charge to the rear, the wrong way, you see." 
- In Congress on February 10, 1875, an African American representative from South Carolina stated that some whites were "the class of men thrown up by the war, that rude class of men I mean, the 'tar‑heels' and the 'sand‑hillers,' and the 'dirt eaters' of the South — it is with that class we have all our trouble...." 
- Tar Heel was used in the 1884 edition of the Encyclopædia Britannica, which reported that the people who lived in the region of pine forests were "far superior to the tar heel, the nickname of the dwellers in barrens." 
- In Congress in 1878, Rep. David B. Vance, trying to persuade the government to pay one of his constituents, J.C. Clendenin, for building a road, described Clendenin in glowing phrases, concluding with: "He is an honest man... he is a tar‑heel." 
- In Pittsboro on December 11, 1879, the Chatham Record informed its readers that Jesse Turner had been named to the Arkansas Supreme Court. The new justice was described as "a younger brother of our respected townsman, David Turner, Esq., and we are pleased to know that a fellow tar‑heel is thought so much of in the state of his adoption." 
- John R. Hancock of Raleigh wrote Sen. Marion Butler on January 20, 1899, to commend him for his efforts to obtain pensions for Confederate veterans. This was an action, Hancock wrote, "we Tar Heels, or a large majority of us, do most heartily commend." 
- The New York Tribune stated on September 20, 1903, regarding some North Carolinians, that "the men really like to work, which is all but incomprehensible to the true 'tar heel'." 
- On August 26, 1912, The New York Evening Post identified Josephus Daniels and Thomas J. Pence as two Tar Heels holding important posts in Woodrow Wilson's campaign. 
- University of North Carolina at Chapel Hill
- Tar Heel, North Carolina
- Tarheel, North Carolina
- Tar River
- Naval stores industry
- "Article on history of term from UNC Alumni webpage".
- "Carolina Traditions". www.unc.edu. Archived from the original on February 17, 2009. Retrieved 2009-03-30.
- "Tar Heel Collection". ncrec.dcr.state.nc.us. Archived from the original on September 25, 2006. Retrieved 2008-06-22.
- Article on shipworm
- The tar heel state: a history of North Carolina.
- State Symbols from NC library Archived 2008-02-06 at the Wayback Machine.
- "Tar Heel Traditions". Carolina Traditions. Archived from the original on February 6, 2005. Retrieved March 22, 2005.
- "Origins of the Term Tarheel". 1st NC Cavalry. Archived from the original on October 24, 2006. Retrieved November 1, 2006.
- NC State library page Archived 2008-02-06 at the Wayback Machine.
- Link to scan of actual letter Archived 2006-09-25 at the Wayback Machine.
- Link to NC State library page Archived 2008-02-06 at the Wayback Machine.
- "Link to Diary of William B. A. Lowrance, November 2, 1862-February 6, 1863". Archived from the original on September 25, 2006.
- Link to NC State library page Archived 2008-02-06 at the Wayback Machine.
- Taylor, Michael. "Tar Heel". NCpedia. Retrieved 27 January 2017.
- "Link to pdf of Sheet Music". Archived from the original on 2006-09-25.
- Michael W. Taylor: Tar Heels: How North Carolinians got their nickname. Division of Archives and History, North Carolina Dept. of Cultural Resources 1999, ISBN 0-86526-288-8