Through his mother, Princess Alice of Battenburg. His father (German/Danish/Russian) was Prince-of-Greece-in-exile and in the line for the crown of Denmark (but pretty far down).
If you Google “Prince Philip Ancestry,” you get a neat banner with all the ancestors, their relationship to him, and pictures.
Yes, I just checked Wikipedia. They say he was born “Prince Philip of Greece and Denmark.”
That’s where I got the idea he was of Greek ancestors. I guess the royals of Europe are all interbred. That must explain Charles.