It used OpenAI's Codex model (see: https://en.wikipedia.org/wiki/GitHub_Copilot?wprov=sfla1)
OpenAI did train the model on GitHub repos. The next question is whether this was enabled by Microsoft's investment in / partnership with OpenAI. I suspect yes, but I haven't gone searching for this yet.