

He may react in unexpected and hostile ways if/when the Combine is ever defeated. However, his only true allegiance is to himself, and his personal motivations remain largely unknown. He is, for the moment, aligned with the resistance movement on Earth, as that's now the only way for him keep his own skin intact.

He also cannot allow Freeman to go free, as he's not willing to lose control of his most effective weapon (though he can be coerced into briefly doing so by the freed Vortigaunts, who hold sufficient numbers to threaten him now). He must do so strategically, picking times and places where Freeman will cause the greatest disruption to the Combine's plans, as he no longer has access to the Combine's military might. Since that time, the G-Man has been using Gordon Freeman as his tool against the Combine's continuing invasion and occupation.

Perhaps the death of Nihilanth allowed him to do so, by weakening the Combine's control/influence over him. However, upon witnessing Gordon Freeman's effective resistance against the extraterrestrial forces and the defeat of Nihilanth, the G-Man decides that it's time to secure his own freedom. To do this he infiltrated Black Mesa and arranged the resonance cascade "accident". His task was simple to open a portal to Xen so that the invasion/subjugation/colonization of Earth could commence. The G-Man has Gone RogueAt the beginning of the storyline, the G-Man was a high-level agent in the employ (probably unwillingly subjugated, like most Combine forces) of the Combine/whatever alien force is ultimately behind the Combine (possibly creatures of Nihilanth's race).
