In gaming, the word "gank" describes the joining of several players to attack an opponent or the attacking of weak players by clearly superior opponents (for example, due to a much higher level). The term gank is very popular in e-sports today, but it has its origins in a completely different subculture.
Originally, the word gank was used as American slang for fake cocaine, which was used to rip people off for money. However, it quickly evolved into a word that stood for general robbing and stealing.
When "Ultimate Online" saw the light of day in 1997 as one of the first MMORPGs, it quickly developed into a practice we now call ganking: The teaming up of multiple players to attack a single player.
However, it was games like DOTA and other popular MOBAs and MMORPGs that made the term gank big. Depending on the game, ganks are a popular tactic to temporarily take players out of the game or steer the match in a specific direction.
For example, ganking in LOL can make sense when a champion is low on HP, you are basically superior in a situation, you want to take a player out of the game for a certain amount of time, or you want to force a passive playstyle.