generating a flux linkage due to excitation of the primary winding, the linkage is then "intercepted" by secondary winding and induces voltage proportional to the flux, number of turn and frequency.
the secondary winding is loaded so current flows, the primary winding now sees a demand on the magnetic circuit to current flows in the primary winding as well in order to keep the working flux almost constant "it depends on the applied voltage, which is almost constant".
so, current in, current out, power in is equal to power out, preserving the energy flow.
The magnetic induction gives galvanic isolation, but two circuits are linked together, the reason is that the magnetic flux/field affects the electrons on metal atoms and give them energy to move and create electromotive force "e.m.f." then if the secondary winding is closed, a current flow.