Shekalim, Chapter 6, Mishnah 3. In the first mishnah of the chapter we mentioned that there were thirteen places in the Beis HaMikdash where one would bow down. Our mishnah comes to clarify exactly where those places were.
The mishnah lists how they were distributed: "arba batzafon, arba badarom, shalosh bamizrach, shtayim bama'arav" - four in the north, four in the south, three in the east and two in the west. And what is the reason for this distribution? "keneged shelosha asar she'arim" - corresponding to the thirteen gates. The places of bowing were set to match the number of gates of the Azarah.
The dispute among the Tanna'im about the number of gates:
The Tanna'im disagree about how many gates there were in the Azarah. On the Temple Mount, on the outside, there were five gates; but regarding the Azarah itself opinions differ - some say there were thirteen gates, and some say only seven. Our mishnah follows the view that there were thirteen, and it now lists them one by one.
The southern gates, from west to east:
Sha'ar Ha'Elyon - the Upper Gate. The Temple Mount rises on its western side, behind the Beis HaMikdash, and from there it gradually descends and slopes downward. Therefore the westernmost gate on the south was called "Sha'ar Ha'Elyon", the highest of them.
Sha'ar HaDelek - the Gate of Kindling, the wood gate, through which they would bring in the wood to be burned on the Mizbe'ach for the arrangement of the fire.
Sha'ar HaBechoros - the Gate of the Firstborn, the gate through which they would bring in the firstborn animals. Since firstborn offerings are kodashim kalim and may be slaughtered in the south, a gate was designated for them in the southern wall.
Sha'ar HaMayim - the Water Gate. "velamah nikra shemo sha'ar hamayim? shebo machnisin tzelochis shel mayim shel nisuch bechag" - and why was it called the Water Gate? Because through it they would bring in the flask of water for the water libation on the festival. Through this gate they would bring in the vessel holding the water for the water libation on the Mizbe'ach on Sukkos. (It is said that the famous Watergate in Washington was named after the Water Gate of the Beis HaMikdash, and there is no way to know whether this is fact or legend.)
Rabbi Eliezer ben Yaakov gives a different reason for the name of the Water Gate, and his reason is rooted in Yechezkel's prophecy about the third Beis HaMikdash in the future: this is the place from which the waters will be "mefachim" - an expression of measure and size, the measure of a small flask or jug - the waters will emerge from beneath the threshold of the House and flow out through this gate.
The northern gates, opposite them, from west to east:
Sha'ar Yechanyah - this is the gate through which King Yechanyah went out in the time of the first Beis HaMikdash when he departed into exile. He was exiled to Bavel even before the destruction of the Temple, and on his way he stopped and came to the Beis HaMikdash to bow down there before going out into exile.
Sha'ar HaKorban - the Offering Gate, through which they would bring in the offerings that are slaughtered on the northern side, and these are many offerings, since they may be slaughtered only in the north of the Azarah.
Sha'ar HaNashim - the Women's Gate. According to the view that women too lean their hands on their offerings, they would enter through it for the leaning; and even according to the view that women do not lean, they wished to stand near their offering.
Sha'ar HaShir - the Gate of Song, the gate through which they would bring in the musical instruments.
The eastern and western gates:
In the east there was the famous gate, the opening on the east, and alongside it two gates smaller than it, one to its right and one to its left - three in all. In the west there were two gates behind the Heichal, behind the Holy, and these gates had no name at all.
And as we mentioned, this mishnah follows - as explained in the Yerushalmi - the view of Abba Yosef ben Chanan, that there were thirteen gates in the Beis HaMikdash. But the Sages hold that there were only seven gates, and according to their view the thirteen places of bowing correspond to the thirteen breaches that the Greek kings broke through when they persecuted Israel - the breaches that we mention in the song "Maoz Tzur". They broke thirteen breaches in the Cheil, the area surrounding the Azarah, beyond which a non-Jew was not permitted to enter. And after the Chashmona'im were victorious, they sealed up those breaches and instituted that people should bow down at those places, as thanksgiving for having merited to conquer the Greeks.