Generally, it was a color of personal significance to a Jedi. For many, they chose to use a crystal emulating the traditional color of their branch (Blue for Guardians, Green for Consulars, Yellow/Orange for Sentinels). However, some exceptions chose to use a color that held meaning to them, or was reminiscent of their master's saber. Thus Mace Windu's Purple saber, or Ahsoka using a green saber despite matching the criteria of a Guardian.
English
-
Mace windu was given the purple crystals from some tribe he helped or something along those lines if I remember correctly.
-
Crystalline aliens, of whom he accidentally murdered one. That's the crystal of his saber, as a reminder to remain calm. It'd be like if Anakin had taken a Krayt Dragon pearl or somesuch from the Tuskens he slaughtered as a reminder to not lose his temper.