It's a bit up to the DM as dimensions may differ from size category
How does the Gate spell (PHB, 244) work?
The spell begins with a description of the size of the portal it opens (emphasis mine):
You conjure a portal linking an unoccupied space you can see within range to a precise location on a different plane of existence. The portal is a circular opening, which you can make 5 to 20 feet in diameter.
It then goes into what happens when you summon a creature whose name is known:
When you cast this spell, you can speak the name of a specific creature (a pseudonym, title, or nickname doesn't work). If that creature is on a plane other than the one you are on, the portal opens in the named creature's immediate vicinity and draws the creature through it to the nearest unoccupied space on your side of the portal.
While it doesn't specifically state that the size of the portal matters, it makes sense that the portal size is a limiting factor in what can go through it. You can't pull a creature through a hole that it doesn't fit through.
But that's where the Squeezing rules may come into play. The squeezing rules are explained very well and state that a Gargantuan creature (the largest size category) should be able to squeeze into the space when looking at the rules regarding creature size categories and the space they control. A Gargantuan can squeeze into a 15x15 space per those rules, but for creatures whose dimensions are listed, it isn't unreasonable to consider that with regard to the portal size.
We can look at the actual dimensions of the creature with regard to the portal size, and we'll use the Tarrasque as an example (MM, 286):
A scaly biped, the tarrasque is fifty feet tall and seventy feet long, weighing hundreds of tons.
That's a fairly big creature to fit into a 20' diameter hole.
While creature sizes are based more on areas of control, the rules on squeezing utilize those sizes. There does seem RAW support for both Yes(gargantuan size can squeeze through 20' spaces) and No(the listed overall dimensions are much larger and it doesn't make sense), and I'd leave it up to a DM as to how they adjudicate size descriptions vs size categories at their table to decide.