We recently discussed the concept of fate and destiny in our post about bashert - let's take a look at few other phrases that also relate to that topic.
Sefardim preferred to place the words siman tov (good omen) top of the text, while Ashkenazim used mazzal tov (good constellation).
During the Middle Ages, we see that in many cases there was still a strong astrological association with saying (or writing mazal tov). Sefer Hasidim writes (see this interesting article by Yaakov Etzion about mazal in general) that when a woman is about to give birth, we should pray that the child be born b'mazal tov (at the auspicious time). And there are sources that say that Jews would marry under the sign of Jupiter, the star also known as "mazal tob". But as I mentioned in the beginning of this post, there were competing ideas in Judaism - those that deferred or rejected astrology and following the Talmudic claim - אין מזל לישראל ein mazal l'yisrael - "the Jews are not subject to the stars", claimed that our prayers or meritorious actions would determine our fate. So perhaps they were the ones wishing mazal tov after a birth or a wedding, regardless of the position of the stars at the time of the event, as a prayer that the true fate was yet to be determined, and it should be good.