Your task in the CartPole environment is simple: move a cart back and forth along a wire so that a pole pivoting on the cart balances upright. In control theory, this is called the inverted pendulum problem, and it is one of several classic control theory problems implemented as reinforcement learning environments in OpenAI Gym.
Here's an illustration of the Gym implementation of the task:
The inverted pendulum as defined in control theory is an underactuated system, meaning it has more degrees of freedom than actuated (controllable) types of movement.
In other words, the position of the cart can be directly controlled, but the movement of the pole cannot. However, the pole can move freely around the joint and the cart can move back and forth. This makes one actuated source of movement and two degrees of freedom.
The inverted pendulum system is unstable...