First, the ball is pulled to A from C. The K.E (Kinetic Energy) from our hand is converted into P.E (Potential Energy) and transferred to the ball. So, at position A, P.E = maximum; K.E = 0 on the ball. Now, the ball moves from A to reach C by converting its P.E to K.E. At C, P.E = 0; K.E = maximum on the ball. As the ball has high kinetic energy, it will automatically move forward to B. At B, all the kinetic energy is converted to potential energy. As a result, P.E = maximum; K.E = 0 on the ball. The ball momentarily pauses at B as the K.E = 0. But at this point, the stored P.E again gets converted to K.E making the ball move in the opposite direction. However, the ball collides continuously with air molecules, losing its P.E and K.E to the air molecules. The ball will eventually come to rest.
In contrast, in outer space there is no atmosphere and so there would be no collision between the ball and air molecules. There would be no loss of P.E and K.E and the swinging process would continue forever.
The swinging of the ball in outer space behaves like a closed system, following the boundaries of Conservation of Energy.