Paul W. answered 05/25/21
The 'Great Wall of China' was built and rebuilt over many centuries. It consisted of many different walls, different sections, that were constructed and altered at different times. In a very real sense, there were many 'Great Wall[s] of China.'
Keeping this in mind, we know from architectural remains - the remains of different sections of the Great Wall - and from surviving written sources that, before there was a single 'Great Wall of China', there were multiple shorter walls. This was because, initially, China was not a single, unified kingdom / empire, rather, it consisted of a number of separate, independent and hostile kingdoms whose rulers built defensive walls to protect their kingdom from the other kingdoms.
It was only after Qin Shihuangdi succeeded in unifying China under his rule in 221 B.C./B.C.E. that a 'Great' wall of [all of] China could be built. In 214 B.C./B.C.E. Qin Shihuangdi ordered one of his Generals, Meng Jian, to build connections to link together all off the different sections of walls built by the previous kingdoms to defend themselves from the threat from the north, thus producing one, single continuous 'Great Wall'.
What was the threat from the north that the different kingdoms that existed before Qin Shihuangdi sought to defend themselves against? North of the Yellow River was a seemingly endless landscape covered in grass known as the 'Eurasian Steppes'. Here, instead of growing crops, people depended for food and most other necessities on herds of animals, particularly horses. They lived a nomadic life, moving periodically from place to place as their herds of horses consumed the grass. These peoples were perhaps the world's greatest horse riders and had perfected the skills of combat while riding their horses. Although usually divided among mutually hostile tribes, these nomadic peoples from the steppes not only attacked each other, but also attacked Chinese communities to the south of the steppes. This was the never ending threat that the Chinese had to defend against and this was the purpose of the 'Great Wall', to prevent nomadic tribes from attacking Chinese communities.
How, then, was the 'Great Wall' actually built? Today, most photographs of the 'Great Wall' show a structure made of brick and stone. However, the earliest version of the 'Great Wall', like all of the walls in China in the time of Qin Shihuangdi, was simply built of dirt! The technique of hangtu (rammed earth), involved setting up a temporary wooden frame, in which dirt was poured. Using special tools, gangs of workers would smash down the earth over and over again, until it was so compacted that it was as hard as stone! This method was so effective that in those locations were sections of the 'Great Wall' that were not rebuilt with brick and stone, the 'rammed earth' walls are still standing after over two-thousand years time. It was only in later centuries that some sections of the Great wall were rebuilt, using bricks and stones. In addition, as the different dynasties (different royal families, whose rule marked the different periods in Chinese history) expanded the size of the Chinese Empire and, in turn, lost control of territory during periods of decline, the course the 'Great Wall' followed and its length repeatedly changed. The final builders of the 'Great Wall' were the rulers of the Ming dynasty (1368-1644 A.D./C.E.), and it is their version of the 'Great Wall' that represents the 'Great Wall' in the minds of most people.
For more on the 'Great Wall of China', see Stephen Turnbull's THE GREAT WALL OF CHINA 221 BC - 1644 AD. Fortress Series No.57. Osprey, 2007.