why the bounds of a sphere renderer changed while the sphere rotate around with its self center

white line is gizmos draw the bounds of the sphere
9709772--1387145--upload_2024-3-19_15-34-32.png
after roate with Y axis 45°,ths bounds changed
9709772--1387151--upload_2024-3-19_15-35-3.png

    private Bounds _bounds;
    // Update is called once per frame
    void Update()
    {
        _bounds = GetComponent<Renderer>().bounds;
        Vector3 extents = GetComponent<Renderer>().bounds.extents;
        Debug.Log(extents);
    }

    private void OnDrawGizmos()
    {
        Gizmos.DrawWireCube(_bounds.center,_bounds.size);
    }

9709772--1387148--upload_2024-3-19_15-34-46.png

It didn’t change - the gizmo won’t rotate with the transform by default.
See here for a solution

See this: Why is bounds size changing when rotating a sphere?

“The bounding box for any mesh is always a cube, which is large enough to contain the mesh regardless of what shape it is. When you rotate the mesh, and therefore the bounding cube, the world-aligned volume that you’re creating with DrawWireCube changes appropriately.”

A renderer bounds is a world axis aligned bound enclosing the underlying model bounds, which is a box, no matter the actual shape of the model.

When you rotate the model, the model bounds rotate with it, resulting in larger extents for the world-aligned bounds :
9709832--1387157--upload_2024-3-19_9-18-45.png
Bounds are only guaranteed to fully enclose the model, they aren’t guaranteed to be of the minimal possible size, and in any practical application will never be.

If you really need minimal world axis aligned bounds, this is only possible with very computationally intensive methods by checking the position of every vertex of the model.

But whatever reason makes you think you would need this is likely a bad idea, as the whole point of bounds is to provide an approximate (but fast) way to compare the volume occupied by a mesh.