how to change an object's axis of rotation on unity code example
Example: rotation around own axis in unity
transform.RotateAround(transform.position, transform.up, Time.deltaTime * 90f);
transform.RotateAround(transform.position, transform.up, Time.deltaTime * 90f);