Aliens built the pyramids. Not wishing to offend but they didn't, nor did aliens build stonehenge. Many Egyptologists will tell you that the knowledge used to build stonehenge was used to build the pyramids.
Due to the cultural genocide by the invading Romans nothing survives of Britain's pre-Roman culture and traditions. So real history, myths and traditions relating to Stonehenge and other structures were lost. However, the megalithic culture began in Ireland and although it has been invaded numerous times, each invader added to the culture rather destroying the previous. Unlike their conitinental cousins the Irish Celts did write things down, which were nicely preserved by Christian scribes. As a consequnce Ireland's culture, traditions, mythology and cosmology survives more or less intact. Thus, not only is it known why the were built; but who built them (which tribes); but what happened to those tribes, the tribes, clans and septs which they became. Right down to their present day survivors. Thus using these sources, along with archaeology, comparative histories, etc., I'll explain how the knowledge was passed on.
Around 3,000 New Grange in Ireland was built, starting the meglithic culture. It's purpose according to Celtic cosmology was an act of symbolic magic in which the light of the sky father would penetrate the womb of mother Earth to make the land fertile. This was constructed before a tribe called the Nemedian's migrated from Ireland and into Europe, taking with them the knowledge of how to build the megalithic structures (such as stonehenge built around 2,000 BC). Who passed it onto others, who used and modified the techniques and designs. Passing the knowledge onto others. One branch of this tribe settled in what is now Britain and became the ancestors of the ancient Britons. The rest continued on, spreading throughout Europe until finally reaching Thrace, in what is now Greece. Historically, ancient Greece and its predecessor traded with and learnt from Egypt, which is how the knowledge was passed on from those how built the megaliths to those who built the pyramids. Who only used those relevant parts.
The Nemedians gave birth to numerous offshoots tribes. One of which were was the Formorians, a member of which was a man named Bolg. He was the founder of a tribe (the Fir Bolg or "men of Bolg") which intermarried with Egyptians and migrated northward and eventually returned back to Ireland shortly after the ancestors of the Greeks had invaded the area. This is supported not just by Irish mythology, comparative history, but by the fact that the Formorians are recorded as being of North African descent, whilst Irish druidry which is created to the Formorians contains clearly Egyptian influences.
Another tribe descended from the Nemedians was the Danaan. Between 2500 and 2,000 BC they migrated northward through Bulgaria, to settle in that part of Romania known as Transylvania. Which historically became the nest from which the Celts came. Remainders of this same tribe stayed in Thrace and became the Danaan's mentioned within Homer's Iliad and in accounts by the Egyptians. In Transylvania they multiplied, going from a tribe called the Danaan, to be known collectively as the Tuatha De Danaan (Tuatha De Dannan in Middle and Modern Irish) which in Modern Irish means "People of the Goddess Danu", but which in Old Irish translates as "Tribes of the God whose Mother is Danu". But who are often referred to as the Tuatha De and referred to as the "Children of Don" within Britian.
One member of the Tuatha De had a son called Gaedhal Glas (Gael the Green, founder of the Gael Celts, who descendants used green as their emblam which is why to this day Irish Gaels are still associated with the colour green). A number of his descendents migrated eastward into Scythia to become the Celto-Scythians (ancestors of the Milesian Gaels). Others tribes descended from him went westward arriving in Ireland as the Tuatha De Danaan around 1014 BC. This is why the Gaels first arrive in Ireland during the Urnfield period, but who didn't become noticeable until the Halstat, while the Milesian Gaels didn't arrive until the 4th Century BC. The arrival of the Tuatha De is recorded with Cath Maige Tuired "The Battle Of Moytura", in which it states:
"The Tuatha De came with a great fleet to Ireland to take it by force from the Fir Bolg. Upon reaching Cocu Belgatan, they at once burnt their boats so that they would not think of fleeing to them. The smoke and the mist which came from the ships filled the land and the air which near them. For that reason it has been thought they arrived in clouds of mist."
Using shorthened versions of this account which ignore references to ships, those who believe in ancient astronauts use them as evidence that the Tuatha De were aliens (but the only references to little green men you'll find within Irish culture are to Leprechauns). But they weren't, as they are the physical ancestors of the Irish, who through various tribes claim descent from one of the tribes which collectivelly formed the Tuatha De Danaan. Who in turn claim descent from Brian (better known in Britain as Bran the Blessed), who was the eldest son of the Goddess Danu (hence "Tribes of the God whose Mother is Danu"). In the 10th Century Christians scholars couldn't get their head around the complexities (due to lack of availble information), so they simply classed the Tuatha De Danaan as the ancient gods of the Irish, even though they were all human. Because the incoming Celtic culture was more land based, it replaced the more sky based religions still being practiced. Which is why the megalithic culture ends around 1000 BC with their arrival, but continued to be used. Around 600 BC the Greeks encounter these tribes. Finding their name difficult to pronounce and give them the nickname of "Celt", derived from Keilt or kilt, the type of skirt they wore.
These facts are never mentioned by supporters of the ancient astronuant theory partly due to ignorance of their existence. But mainly because its takes a lot of work to get the information which allow you to join the dots, reading Old, Middle and Late Irish texts, etc. Whilst to understand Celtic cosmology, requires years of study and trying to obtain access to texts from private and educational achieves. Including those held by Trinitry College Dublin, The Dublin Institute for Advanced Studies, Royal Irish Academy and the Irish Texts Society. As well as an understanding of Classical literature, ancient history and Egyptology. Whilst trying to seperate real information from the tripe produced by New Age Druids. No offence but the real evidence not only shows that they megalithic structures and the pyramids were of human construction and not alien. However this doesn't negate the possibility of alien influence elsewhere.