Trained AI models are
arguably fair use under the "transformative" prong (which is itself a relatively new concept in copyright law), but they are also
arguably derivative and thus infringing: there's a strong possibility that training generative AIs on copyrighted work will be found an infringement by the courts, whenever a case makes it to adjudication.
If Copilot emanates chunks of copyrighted code verbatim, that makes it harder to argue that it's a truly transformative use. An apposite ruling can be found in Warner Bros. v. RDR Books, 575 F.Supp.2d 513 (SDNY 2008), which found against the defendant due to the reproduction of extensive verbatim passages from the Harry Potter books in a reference book about the series; in this case, one could argue that Copilot fixes in a tangible medium (thus evading Galoob) verbatim copyrighted code without annotation or commentary; indeed, the entirety of the model is nothing more than copyrighted material. (The counterargument is that the text embeddings are fundamentally transformative and thus protected in the same way a third-party index or concordance would be.)
Google v. Oracle, meanwhile, distinguishes between an API signature, which "provides a way ... to access prewritten computer code" from "the code that actually instructs the computer to execute a task," noting that "Google did not copy the task-implementing programs ... from the Sun Java API." In addition, the decision in that case rested in part on the fact that Google only copied a small portion of the Java codebase, whereas in this case Microsoft used the entirety of the repos.
As for YouTube, that's a different matter -- DCMA doesn't apply here, because Copilot isn't a service provider, it's the alleged infringement itself.
To summarize, one argument against Microsoft is that:
1. Training an AI model on copyrighted work does not substantially "transform" the work, but merely fixes it in a different format and generates additional derivative works from the copyrighted material;
2. The code being used is not merely "descriptive" (as in API signatures) but is creative in nature;
3. The entirety of the work is being indiscriminately consumed in the process; and
4. By generating derivative works, Copilot reduces the value of software developers and undermines the market for further software creation.
While there are plenty of arguments in favor of Microsoft, I wouldn't assume that fair use is a slam dunk defense.