Gilgamesh could possibly be fit in any class mainly thanks to all the items he has in the Gate of Babylon. He was quite possible chosen by the Holy Grail to fill the Archer Class as his personality would fit a very high level of Independent Action, the Wikia page also says:
He is able to easily ignore his Master's orders, making it possible to stroll around without making his Master aware of his whereabouts. The only way to command him is through the use of Command Spells, but his disposition that does not even contain an ounce of respect for his Master makes utilizing them idly a bad move.
It should be noted that the Servant Classes except the special classes (like Ruler, Avenger, Funny Vamp) allows a hero to be classified under more than 1 if they display the potential to be summoned as a different class. With the Archer Class, Heracles and Lu Bu were both summoned as Berserk but could be summoned as Archer, while Karna was summoned as a Lancer
Another example is Archer in the 5th Holy Grail War. The weapon he mainly uses in fact a pair of swords Kanshou and Bakuya, which we see him use for the first time during the first night as he fought Lancer. This annoys Lancer because he figured out Archer's Class but he was skilled with sword. Archer’s Bow is mainly just a normal Bow he projects and uses weapons like Caladbolg II as ammunition.
Though with that said, after the 3rd Holy Grail War and Avenger's corruption of the Great Holy Grail - the main engine to the ritual, the system for assigning classes to heroes may have been damaged. Both the 4th and 5th War's Archers didn't clearly fit the Archer Class, and normally only the Hassan-i-Sabbah should have been summoned as Assassin in the Fuyuki System, however Caster was able to summon Sasaki Kojiro.