Problem with transform.position of an object not the same as the object's pivot.

I have been getting strange results from a raycast operation and decided to use Debug.DrawRay to visualize the ray.
What I noticed is that my transform.position doesn’t line up with my object’s pivot.

I attached a script to my object and had the following code:

Debug.DrawRay(transform.position, -Vector3.up);

and

Debug.DrawLine(transform.position, Vector3.zero);

And this is what I got:

I thought that an object’s transform.position is the same as the pivot. Why are the two not lining up?

have tried transform.localPosition?

In the top-left area of Unity’s editor, there’s a button that reads either “Pivot” or “Center”. If it’s center, you’ll get the behaviour you’re seeing if the selected object has child objects, or if you have multiple objects selected. If it’s pivot, the gizmo should appear at the selected object’s actual pivot.