Which temprature is taken in Gibbs free energy equation, of the system or the surrounding?
The Gibbs free energy is a property of a system, so you should use that system's temperature when calculating it.  The Gibbs free energy is the amount of work that could be extracted from the system in a isothermal, isobaric process: i.e. the temperature and pressure of the system won't change.  Thus Gibbs energy has to do only with the temperature of the system, not of the surroundings.

There is a related but distinct variable called exergy or sometimes "availability".  This variable is given the symbol $B$, and is also a thermodynamic state function.  It is defined as $\Delta B = \Delta H - T_0 \Delta S$, where $T_0$ is the temperature of the surroundings.

Exergy represents the maximum amount of work that could be extracted from a system when that system is brought into thermal equilibrium with the surroundings, for example using Carnot engines.  Thus exergy indicates work obtainable through a combined (a) isothermal change in Gibbs free energy at temperature $T \neq T_0$ and (b) a temperature change occurs when Carnot engines are used to transfer heat from the system at $T$ to the surroundings at $T_0$ until thermal equilibrium is obtained.