The first vowel tells you from which country it comes.
Grey is UK English, so think "e" for England.
Gray is American English, so think "a" for America.
Somewhat oddly, "grey" has ended up pretty normalized in the US so either works. There are a few other examples; theatre comes to mind. In a way that lots of other British spellings really have not.
> I can never remember if I should use grey or gray
Become a web/CSS developer and it won't matter anymore.