Why do we bow for oseh shalom in shmoneh esre and kaddish? There are two parts to this:
- What is the relationship between bowing in general and oseh shalom?
- What does each direction in which we bow have to do with the corresponding phrase?
According to the Beit Yosef (OC 123; citing Rav Hai Gaon), the custom is based on the idea that the tefillos correspond to the tamid offerings. When the kohen would go up to the altar, he would go up on the right side, go around, and descend on the left side. We face left first, then right, because we are orienting ourselves according to the Shechina's orientation, which we face when we pray.
Furthermore, the original custom is not exactly to bow in three directions. The Shulchan Aruch writes: "...[A]nd after he takes three steps back, while still bowed forward a bit before straightening up, when he says Oseh shalom bimromav he turns his face to his left, and when he says Hu ya'aseh shalom aleynu he turns his face to his right, and afterwards he bows forward like a servant departing from his master." (OC 123:1) So the bowing part doesn't have much to do with the directions; we simply bow forward in deference to HaShem as we take leave of our prayers.
The custom to do the same at the end of kaddish is stated in Hilchos B'rachos (ibid. 56:5). The Vilna Gaon comments here that he holds that these are extra bows and are forbidden. However, he endorses the bowing at the end of the Shemoneh Esrei, which is originally described in the gemara (Yoma, 53b).