how transformer came to know that it has to draw lagging current during summers
it does not have a clue about seasons. transformers are inherently inductive devices and thisn means current lags any day of the year
The transformer itself is inductive, as others have said, so it will always appear as a lagging load. Now, in the summer, most people are using their air conditioning systems, which are quite inductive because they're essentially just motors. So, the load attached to the transformer could be a good bit more inductive than in other seasons.
A transformer on open circuit is just an inductance and that will draw a small lagging (magnetising) current in that operation mode. On load, the phase of the current drawn will depend on the load. If the load is capacitive then the transformer may well draw a net capacitive current. The small inductive contribution due to the magnetising current will still be there but may be subordinate to the load. The season is of no significance.