Here's why:
* Synonym refers to a word that has the same or nearly the same meaning as another word.
* Of is a preposition that shows a relationship between two things.
Therefore, you would say:
* "A synonym of happy is joyful."
"For" would not be grammatically correct in this context.