Transformer is to transform AC voltage, current and impedance of the device, when the primary have AC, core will produce AC magnetic flux, induced in the secondary coil voltage (or current).
Transformer is composed of core and the coil, winding two or more coil, which connect power winding is primary coil and the rest of the winding is called secondary coil.