This paper reports a characteristic motion of a polarity inversion line (PIL) formed at the solar surface, which is newly found by performing a three-dimensional magnetohydrodynamic simulation of flux emergence in the Sun. A magnetic flux tube composed of twisted field lines is assumed to emerge below the surface, forming a bipolar region with a PIL at the surface. A key finding is the successive half-turn rotation of the PIL, leading to the formation of a quadrupolar-like region at the surface and a magnetic configuration in the corona; this configuration is reminiscent of, but essentially different from the so-called inverse-polarity configuration of a filament magnetic field. We discuss a physical mechanism for producing the half-turn rotation of a PIL, which gives new insights into the magnetic structure formed via flux emergence. This presents a reasonable explanation of the configuration of a filament magnetic field suggested by observations.