From National Geographic:
The legend goes like this, as mentioned in the Talmud:
"When the Samaritans had obtained permission from Alexander to destroy the Temple in Jerusalem, the high priest Simon the Just, arrayed in his pontifical garments and followed by a number of distinguished Jews, went out to meet the conqueror, and joined him at Antipatris, on the northern frontier. At sight of Simon, Alexander fell prostrate at his feet, and explained to his astonished companions that the image of the Jewish high priest was always with him in battle, fighting for him and leading him to victory. Simon took the opportunity to justify the attitude of his countrymen, declaring that, far from being rebels, they offered prayers in the Temple for the welfare of the king and his dominions. So impressed was Alexander that he delivered up all the Samaritans in his train into the hands of the Jews...
Far more details of the legend come from Josephus:
Now Alexander, when he had taken Gaza, made haste to go up to Jerusalem; and Jaddus the high-priest, when he heard that, was in an agony, and under terror, as not knowing how he should meet the Macedonians, since the king was displeased at his foregoing disobedience. He therefore ordained that the people should make supplications, and should join with him in offering sacrifice to God, whom he besought to protect that nation, and to deliver them from the perils that were coming upon them; whereupon God warned him in a dream, which came upon him after he had offered sacrifice, that he should take courage, and adorn the city, and open the gates; that the rest should appear in white garments, but that he and the priests should meet the king in the habits proper to their order, without the dread of any ill consequences, which the providence of God would prevent. Upon which, when he rose from his sleep, he greatly rejoiced, and declared to all the warning he had received from God. According to which dream he acted entirely, and so waited for the coming of the king.This explains why Alexander is giving the bull to the High Priest in the mosaic, as a sacrifice.
And when Jaddus understood that Alexander was not far from the city, he went out in procession, with the priests and the multitude of the citizens. The procession was venerable, and the manner of it different from that of other nations. It reached to a place called Sapha, which name, translated into Greek, signifies a prospect, for you have thence a prospect both of Jerusalem and of the temple. And when the Phoenicians and the Samarians that followed him thought they should have liberty to plunder the city, and torment the high-priest to death, which the king's displeasure fairly promised them, the very reverse of it happened; for Alexander, when he saw the multitude at a distance, in white garments, while the priests stood clothed with fine linen, and the high-priest in purple and scarlet clothing, with his mitre on his head, having the golden plate whereon the name of God was engraved, he approached by himself, and adored that name, and first saluted the high-priest.
The Jews also did all together, with one voice, salute Alexander, and encompass him about; whereupon the kings of Syria and the rest were surprised at what Alexander had done, and supposed him disordered in his mind. However, Parmenion alone went up to him, and asked him how it came to pass that, when all others adored him, he should adore the high-priest of the Jews? To whom he replied, 'I did not adore him, but that God who has honored him with his highpriesthood; for I saw this very person in a dream, in this very habit, when I was at Dion in Macedonia, who, when I was considering with myself how I might obtain the dominion of Asia, exhorted me to make no delay, but boldly to pass over the sea thither, for that he would conduct my army, and would give me the dominion over the Persians; whence it is that, having seen no other in that habit, and now seeing this person in it, and remembering that vision, and the exhortation which I had in my dream, I believe that I bring this army under the Divine conduct, and shall therewith conquer Darius, and destroy the power of the Persians, and that all things will succeed according to what is in my own mind.'
And when he had said this to Parmenion, and had given the high-priest his right hand, the priests ran along by him, and he came into the city. And when he went up into the temple, he offered sacrifice to God, according to the high-priest's direction, and magnificently treated both the high-priest and the priests. And when the Book of Daniel was showed him wherein Daniel declared that one of the Greeks should destroy the empire of the Persians, he supposed that himself was the person intended.  And as he was then glad, he dismissed the multitude for the present.
But the next day he called them to him, and bid them ask what favors they pleased of him; whereupon the high-priest desired that they might enjoy the laws of their forefathers, and might pay no tribute on the seventh year. He granted all they desired. And when they asked him that he would permit the Jews in Babylon and Media to enjoy their own laws also, he willingly promised to do hereafter what they desired. And when he said to the multitude, that if any of them would enlist themselves in his army, on this condition, that they should continue under the laws of their forefathers, and live according to them, he was willing to take them with him, many were ready to accompany him in his wars.
There is a further extension of this legend that Jews vowed to name their sons Alexander in honor of his sparing the Temple. Indeed, it is one of the very few Hebrew names that have been used through the centuries that did not have a Biblical or Hebrew language origin.