Why do objects go further away?

I’ve recently tried to rotate an object, but it keeps going further and further away from the origin point (0, 0, 0).

Could you share the code you are using to rotate and otherwise transform the object?

It sounds like you are translating the object after rotating it, which will cause it to move to a different direction, and will look like the rotation is at fault.