A transformer isolates one part of a circuit from another by utilizing two separate coils of wire wound around a common core. When an alternating current flows through one coil, it generates a magnetic field that induces a voltage in the secondary coil without any direct electrical connection between the two coils. This allows for the transfer of power from one circuit to another without creating a direct electrical path, effectively isolating the two circuits.