The god Ammon, who is usually shown with the horns of a ram, was initially venerated by Libyan desert tribes only. He may have been related to Ba'al Hammon, a god of the Semitic peoples (e.g., the Phoenicians and Carthaginians). However, this is just a hypothesis, based on the similarity of the names only, and we can not be really certain about the origin of this cult - as is nearly always the case when we discuss an aspect of ancient religion.
The cult was taken over by the Egyptians, who identified the god with their supreme god Amun; they called god of the oracle "Amun of Siwa, lord of good counsel". The first pharaoh said to have sacrificed to this god was Bocchoris (r.718-712), but the report, which was written in the second century CE by the Roman author Tacitus, is late and belongs to a rather suspect text; as a consequence, we can not be certain that it is true. note[Tacitus, Histories 5.2-5.] It is quoted here.
Another center was the Macedonian town Aphythis, Macedonian A satellite photo of the oracle in Siwa can be found here. prince Alexander must have seen the When he had Siwa (February 331; text). According to Arrian of Nicomedia, Alexander did this because he wanted to imitate his legendary ancestors Perseus and Heracles. This is an odd couple: Perseus never played a role in Alexander's propaganda. However, since the fifth century, Perseus was regarded as the ancestor of the Achaemenids, the Persian royal house; and everybody knew that the Macedonian kings descended from Heracles. Following in the footsteps of Heracles and Perseus was therefore, in a sense, a religious preliminary to the conquest of the Achaemenid empire.
It is possible that Alexander had already started to venerate Ammon, because during the sack of the Greek town of Thebes, he ordered that the house of Pindar had to be spared. On the other hand, there is no evidence that Alexander worshiped the ram-god before he visited Siwa.
However this may be, the result was important: Alexander was greeted as Ammon's son, and started to believe that he was a demi-god indeed. According to an admittedly hostile source, Ephippus of Olynthus, Alexander sometimes wore the horns of his divine father Ammon on public occasions. We can not establish the truth of this story, but it is certain that immediately after his death, he was depicted in this fashion.
In the Zoroastrian tradition, Alexander was considered to be an associate of the evil spirit, the eternal rival of the Persian supreme god Ahuramazda. Ever since, the devil is depicted with ram's legs and horns.
Another famous visitor was the Carthaginian general Hannibal, who received the oracle that he would be buried at Libyssa, which Hannibal knew as a town in Africa. However, it turned out that there was a town in Bithynia with the same name, and this was indeed Hannibal's burial place, as the historian Appian of Alexandria writes in his History of the Syrian wars.
In the Roman age, the oracle was not really forgotten, but there were not many visitors. Yet, the god, now known as Jupiter-Hammon, was still extremely popular. The emperor Augustus used images of the god in the forum he dedicated to Mars the Avenger in Rome, and the soldiers of the Third legion Cyrenaica were especially fond of Ammon.
The cult had now spread as far as the river Rhine, far away from the god's Egyptian place of birth. This can be illustrated by the impressive bust of Ammon, which was discovered at Lechenich near Bonn in Germany.