From the very beginning Gally is painted as the sulking, nasty bully of the group. He vaguely remembers Thomas from the memories he regained during the Changing, and although he doesn't know why he remembers him, he knows it's not good. Instead of keeping these negative thoughts to himself, however, he spends his time glaring at Thomas and making empty threats.
Whenever there is a meeting regarding Thomas or one of his plans, Gally is sure to be there, fighting every step of the way. A pure antagonist, he hates Thomas and will do everything in his limited power to thwart his progress.
Although it seems a bit over-the-top, Gally has his own reasons for hating Thomas, and especially what Thomas represents. Gally is one of the few who went through the Changing and saw what life was like outside the Glade, and he remembers the Flare and how horrible conditions are in the real world. So even though he can't remember Thomas's role in getting to the Glade, he does know that he's the one who will help them escape, and he will fight to his last breath against going back. Quite literally, actually: Gally dies sacrificing himself to a Griever rather than returning to life outside the Glade.
So outside of just being yet another obstacle that Thomas faces, Gally is a means to show us how utterly horrible the world outside the Glade really is. He'd rather spend the rest of his life in a field surrounded by a Maze that houses death-dealing monsters (or get killed by one of them) than go back to the real world. It must be pretty gruesome.