Hi I have a circle that moves from A to B. During this path I want to change its size. However, when I do this, the ball suddenly goes up and is not following the path anymore. Heres a gif:
How can I scale the ball so that it stays on the path?
The issue you're experiencing is that the transformation of the circle does not originate where you expect it to be.
This is because the anchor point of the layer is very far from the center of the visual contents.
You can re-position the anchor point of the layer using the "Pan Behind" tool (also known as "Anchor Point" tool.)
There are scripts that will do this while preserving the visual position of the layer on the canvas; one of my favorites is Motion 2 by Mt. Mograph and a very simple, low-cost script is RepositionAnchorPoint by Charles Bordenave
My suggestion would be to first experiment on a copy of your composition to see how manually adjusting the anchor point with the "Pan Behind" tool affects your animation, and once you have a strong grasp on how After Effects implements the changes you make, trying out one of the scripts linked above.
This happens because the Circle anchor point is placed far from it.
Its a good practice to center the Anchor Point to the center of the object before animating it, you can do that manually by:
Clicking Pan Behind tool then drag the anchor point to the center of the object or,
Ctrl + Double Click on Pan Behind tool to center automatically. This won't work with all objects/layers.