When two containers at different T and P are kept together, will pressure become same or temperature?
The situation that is being covered in your class is where the two containers are thermally insulated from one another.  In this case, the only place where heat can be transferred from one container to the other is through the gas in the valve (by conduction).  But the assumption is being made in your class problem that heat conduction through the gas in the valve is negligible.  In any event, even if the valve were left open until the pressures effectively equilibrated, the temperatures in the two containers would require a much larger time to equilibrate.  So, if the assumption is made that, once the pressures effectively equilibrate, the valve is closed again (and does not allow heat transfer between the containers), then at final thermodynamic equilibrium, the temperatures of the gas in the two containers will be different.