I actually didn't understand why did Gilgamesh remain in the human world. What I understand is that he touched the Grail that's why he remains.
Initially, it's stated that servants are kept in the world by the Holy Grail. (This comes up in the Good End of "Unlimited Blade Works," but I imagine this piece of information might have appeared earlier.) They also need a mana supply; note also that servants who had become separated from their masters in Fate/stay night did not immediately disappear. In the case of Gilgamesh, both of these conditions were fulfilled. The Holy Grail was still around, and Kotomine kept the orphans from the fire under the church and used them as a mana source.
In the events of Fate/stay night, other servants were also retained, even when the Grail was destroyed. In the "Good End" of the "Unlimited Blade Works" route, Saber stays in the human world. Rin has been supplying mana to her, and she asks Shirou to help her. Similarly, in the "True End" of "Heaven's Feel", Rider stays with Sakura even after the destruction of the Grail; per the wiki, this is possible because Sakura has enough mana reserves because of her connection to Akasha.
The Wikia also gives an explanation of what happened to Gilgamesh at the end of Fate/zero. (I cannot provide much more commentary on this, since I haven't followed the series lately.)
Due to his proximity, Gilgamesh is caught off guard and becomes drenched by the pollution that spills from the Holy Grail. He obtains a physical body, and because he has been incarnated into the world, he decides that it is time to once again unite the world under his rule. He continues to follow Kotomine after the war is over, and Kotomine provides him with energy drained from children orphaned by the fire to sustain himself. He decides to wait for the next Holy Grail War to cleanse humanity, so he retrieves a potion of temporary youth from his vault that reduces his physical age and allows him to smoothly blend in with society for ten years.