Think of it as MS Paint where the game is the painting and the paint application is the API. A graphics API is a platform where the actual game designing and mechanics are figured out. Now, what does a graphics API like DirectX do? It acts as an intermediate between the game engine and the graphics drivers, which in turn interact with the OS Kernel. OpenGL and Vulkan, on the other hand, run on Mac as well as Linux.
However, unlike its counterparts, DX is a Microsoft proprietary platform and only runs on Windows natively. Like Vulkan and OpenGL, DirectX is an API that allows you to run video games on your computer. But what exactly is DirectX 12 and how is it different from DirectX 11. This includes better CPU utilization, closer to metal access as well as a host of new features most notably ray-tracing or DXR (DirectX Ray-tracing).
DirectX 12 debuted two years back, promising significant performance and efficiency boosts across the board.