I am trying to simulate a transformer with a turn ratio of 1:1. The voltage of the primary and secondary are equal but I am getting a different current in the winding (why?). Also I see some DC offset in the primary current (why?). Please correct me if I am simulating design wrong. Thanks
I am getting different current in winding(why?)
The primary current contains the load current AND the magnetization current. The secondary current is only the load current.
Magnetization current is due to the voltage supply being attached to an inductor (with secondary open circuit).
You'll need to be clearer about what DC offset you are seeing but i suspect it doesn't really exist after the first few cycles of AC have passed.
As @Andyaka said, the primary current is the sum of the load current and the magnetizing current. The secondary current is just the load current.
If you want to see them separately you can use the equivalent circuit of the transformer. To make an ideal transformer you set the inductance to be high enough (ideally infinite). Then you add a magnetizing inductance in parallel with the primary equal to your transformer inductance (10mH in your case).
As you can see I(L1) and I(L2) now match perfectly. I(Lm) is the magnetizing current. I(R2) is the primary current that you were seeing in your simulation and is the sum of I(L1) and I(Lm).