What happens when aboriginal people who are living a hunter/gatherer or farmer life style come face to face with 20th century technology and civilization too quickly? Their minds could not fathom the rest of earth's human civilization gradual progression over the past 5,000 or so years.
The people of Tanna island of Vanuatu suddenly woke up during World War II to the U.S. Navy establishing airfields, forward bases, and housing close to 250,000 people, with all the necessary support services, including telephone and cinemas.
And just as the Americans appeared suddenly, they also disappeared quickly. Gone are the ships that brought in 'Cargo', all the goods that modern civilization produces, from Coca Cola, to tinned food, clothes, weapons, ...etc.
Goods arriving from the sea, and the sky, from apparently nowhere, and their sudden disappearance caused a huge cultural shock to those who have not had time to grow technologically and culturally over several millennia.
The islanders never saw what a modern city looks like, with all the factories that use labour and machinery to convert raw material into goods used for a myriad of purposes.
The islanders attribute the arrival of cargo to magic: the white man scribbles symbols on paper and the cargo arrives by ship and plane.
So, they erect look alike control towers, runways, and dummy airplanes. They have military like uniforms, and bamboo rifles. They drill like infantry with their fake rifles. They also have a 'flag raising' ceremony.
By going through all these motions, they hope that 'cargo' will come back.
The phenomenon was also observed elsewhere in Melanesia, from Papua New Guinea to Fiji, as per this Scientific American article from 1959.
The term Cargo Cult has become synonymous with those who go through the motions, without understanding the rationale for these motions, or the chain they fit in. Cargo Cult Programming is one such application for software development.