See the question and my original answer on StackOverflow

DXGI ships with Windows since Windows Vista. So, with newer versions of Windows came newer versions of DXGI.

You don't see that reflected in the official documentation because Microsoft only mentions the supported versions to date (this is not 100% true everywhere but often we see that).

So since IDXGIFactory5 documentation page displays this:

enter image description here

It means IDXGIFactory5 is supported on Windows 10 (which is still supported as of today). If you check IDXGIFactory6 page, it says:

enter image description here

We can't go back in time, but, for example, Windows 7 only supports DXGI up to IDXGIFactory2.

You can also check header files (dxgi1_5.g, dxgi1_6.h, etc.) because sometimes the doc is wrong... but... headers can also be modified with newer versions of SDK.

As for using CreateDXGIFactory1(IID_PPV_ARGS(&factory5)); directly, it should work (and if it does then it's fine) since this is the purpose of accepting an IID-type argument in the first place, but experience shows that sometimes this kind of shortcut is not supported by the underlying implementation for some reason.

Note: you can also use the exact same code on lower version of Windows where you should get an E_NOTINTERFACE error, which is expected and normal behavior.

The story is about the same with Direct3D and Direct2D object models (and the whole Windows COM-based API basically).