Phase shift in a transformer occurs due to the magnetic coupling between the primary and secondary windings. When alternating current flows through the primary winding, it creates a magnetic field that induces a voltage in the secondary winding. This process inherently causes a phase difference between the input and output voltages, typically resulting in a shift of 30 degrees for delta to wye configurations. The phase shift is crucial for applications like three-phase systems, ensuring proper load balancing and power distribution.