OpenGL (Open Graphics Library) and game engines serve different purposes in the realm of game development.
OpenGL is a cross-platform, low-level API that provides developers with tools to render 2D and 3D vector graphics. It doesn't handle tasks like physics simulations, AI, or input handling—these features lie outside its scope. OpenGL only deals with the visual component, translating geometric data into images on your computer screen. Here's a simple OpenGL example which creates a window and clears it with a color:
On the other hand, a game engine is a comprehensive software framework used to build games. Unity, Unreal Engine, and Godot are examples of popular game engines. Game engines provide a suite of visual development tools for designing, simulating, and rendering game environments and characters. They also handle physics, audio, scripting, animation, AI, and much more. A game engine uses APIs like OpenGL, DirectX, or Vulkan to perform the actual rendering.
In short, you could say that OpenGL is a component that a game engine could use to accomplish its tasks. It's a tool in the toolkit of the larger, more complex game engine.