"Grey" is the preferred spelling in Britain, whereas "gray" is more popular in America. You can remember the difference by thinking that the "a" in "gray" is for "American."
I'm American, but I enjoy Earl Grey tea (named after Charles Grey, 2nd Earl Grey, the British Prime Minister from 1830 to 1834), and I regularly look at my tea box, so I was often confused about the spelling before I came up with the "a"-is-for-American memory trick.
Following the British-versus-American pattern, Gray's Anatomy is a well-known medical textbook written by British anatomist Henry Gray, and Grey's Anatomy is an American medical drama that airs on ABC.
Grammar Girl