How to name such grouping behaviour?
I believe it is a type of fission-fusion society or even some hybrid with agent based modeling. 


  In ethology, a fission–fusion society is one in which the size and composition of the social group change as time passes and animals move throughout the environment; animals merge (fusion)—e.g. sleeping in one place—or split (fission)—e.g. foraging in small groups during the day. For species that live in fission–fusion societies, group composition is a dynamic property [fission-fusion society].


A classical example is the Bonobo or pigmy chimp.


Bonobo - Pigmy Chimpanzee
Sociobiology
The Social Behavior of Chimpanzees and Bonobos