ChatGPT by uses the GPT3 language model, that uses the Common Crawl data set containing much of the internet. And online there are many sites that have music printed in ABC notation. The ABC notation in ASCII is perfect for GPT3 to analyse and ChatGPT to output.