COM's `QueryInterface` is a library-level implementation of dynamic (checked) casting.

There is no design pattern describing this because design patterns are typically solutions for problems that do not have a trivial language-level solution. Dynamic casting, however, has a trivial language-level solution in most languages.

However, given that different languages support different features, the line between language features and design patterns can be blurry. For example, the Command pattern is pretty much a library-level implementation of first-class closures. More concretely, IIRC Scala has a language-level implementation of Singleton.

This means that the first sentence of this answer is a sufficient description of the functionality, even though you probably won't find "Dynamic Cast" in any list of design patterns.