Yeah you have the pivot set to the 3D cursor, you can see it in your screenshot:

So the transform gizmo will be wherever the 3D cursor is. If you want it to be at he middle of your selection, you can se tit to bounding box center or Median point as Leo says.