For those interested in obscure history of graphics, long time ago (we are talking about 2006-2007) the OpenGL committee was working on a next gen version of OpenGL 3.0 codenamed "Longs Peaks". It was supposed to be a forward-looking clean slate redesign of the entire API. Some slides
were published which got the community very exited — I still remember how the devs were happy to finally get a proper modern API instead of working with the extremely messy and hard to debug OpenGL state machine. But then the committee went into media blackout and when they reemerged and announce the "OpenGL 3.0" it was not what we expected. What we got was basically the same old OpenGL with few minor features and a soft deprecation of some old functionality. Nobody really knows what happened back then and why the promising approach was abandoned, there was just a cryptic "we ran into issues" without much explanation. Most likely the committee either couldn't agree on some details or was actively sabotaged.
This was essentially the beginning of the end for OpenGL. Many devs — who were sticking with the API because they believed in open standards and hoped that 3.0 will solve the issues people have complained about for a decade — just threw in the towel and switched to DirectX. The OpenGL community, once very strong and active, slowly fell apart and the OpenGL committee became somewhat of a running joke on the official GL forums.
I believe — and mind, this is just a speculation! — that Apple was among those frustrated by this development. They would have immensely benefited from the simplified API model due to their driver model (for example, they were the first implementor to drop the legacy OpenGL features and only implement the modern programmable shading profile). The nature of OpenGL abstractions makes performance unpredictable and requires a lot of software-specific driver-side optimisations to achieve good results — something Apple was not in the mood of doing (unlike the hardware vendors who could use this as a mechanism to promote their products). They probably started working on Metal around 2012, when it became abundantly clear that the open source approach wasn't producing any useful results (Apple submitted the initial OpenCL proposal to Kronos around 2008 if I remember correctly). Apple was also quick to join the initial Vulkan effort when the initiative was announced, but dropped out quickly as it became clear that the API was moving in a very different direction from what Apple would have liked. Well, at least they have managed to significantly influence the WebGPU spec to be conceptually similar to Metal.