When you set the Dimensions of an object, it is scaled to fit in a bounding box of the given size in the X, Y and Z of the object's local axes. (The XYZ of Object Space) The scale is not necessarily uniform.
A regular hexagon does not fit into a square. If it is 1 unit high, with corners top and bottom, it is sqrt(3) / 2 units wide.
So if you want to set the dimensions of the bounding box to contain a regular hexagon, height H
, you would set the Y dimension to H
, and the X dimension to H*0.866
, which you can enter straight into the X field.
BTW, It's wise, (unless you have special reasons,) if you have scaled an object in Object Mode, to CtrlA > Apply the scale of the object before proceeding, because of side-effects of non-uniform scaling in the object's transform on things like modifiers, further down the line.