This is the two-piece plug which receives the wire from a dynamo headlight. The plug then snaps onto the connector on Shimano dynamo hubs. The hubs ship with this part but it is easy to lose. Carry a spare.
While these are optimized for Shimano hubs, they will also function on Shutter Precision or Kasai dynamos. The fit is quite tight however, so use care when removing the connector and be sure not to pull on the wires themselves.