In February 332, Alexander visited the oasis Siwah in the Libyan desert, where he consulted the oracle of Ammon. Nobody knows exactly what Alexander asked and what the god replied; but it is certain that Alexander started to think of himself as the son of Ammon. The Greek author Arrian of Nicomedia describes the events in section 3.3-4 of his Anabasis, which was translated by M.M. Austin.
Alexander visits Siwah
[3.3.1] At this point Alexander was seized with a longing to visit Ammon in Libya; his intention was to consult the god, as the oracle of Ammon was reputed to be truthful and it was said that Perseus and Heracles had consulted it [...].
[3.3.2] Alexander wanted to rival Perseus and Heracles, since he was descended from them both, and was also seeking to trace his birth back to Ammon, just as mythology traces that of Heracles and Perseus to Zeus. He therefore set out for Ammon in this frame of mind, with the intention of finding out more exactly about his origins, or of claiming he had found out.
[3.3.3] The journey along the coast as far as Paraetonium was through deserted, though not waterless, country, for a distance of 280 kilometers according to Aristobulus. From there he turned inland, where the oracle of Ammon was to be found. The road is deserted, sandy for the most part and without water.
[3.3.4] But Alexander had the benefit of heavy rains, and he ascribed this to the divinity.
Another occurrence was attributed to divine intervention: whenever a south wind blows in that country, much of the road is covered with sand and the road marks disappear. One is in an ocean of sand, as it were, and it is impossible to tell one's direction, as there are no mountains or trees or solid hills to serve as signs and guide the travelers on their way, just as sailors go by the stars. Hence Alexander's army was advancing aimlessly and the guides could not tell the way.
[3.3.5] Ptolemy son of Lagus relates that two speaking snakes preceded the army and Alexander ordered the guides to follow them and trust in the divinity; the snakes then led the way to the oracle and back again.
[3.3.6] But Aristobulus says (and most writers agree with him) that two crows flew in front of the army and served as guides to Alexander. I can assert that there must have been some divine intervention to help Alexander, because this is what seems probable. [...]
[3.4.1] The area where the sanctuary of Ammon is situated is circular in shape; it is completely deserted, covered with sand and waterless, but the site itself is small (it has a maximum breadth of 7 km). It is full of garden trees, olives and palms, and is the only part of the area to catch the dew [...].
[3.4.5] Alexander admired the site and consulted the god, and having received, as he put it, the answer which his heart desired he returned to Egypt by the same road, as Aristobulus says, though according to Ptolemy he followed a straight road to Memphis.