Many distributed systems continuously gather, produce and elaborate data, often as data streams that can change over time. Discovering anomalous data is fundamental to obtain critical and actionable information such as intrusions, faults, and system failures. This paper proposes a multi-agent algorithm to detect anomalies in distributed data streams. As data items arrive from whatever sources, they are associated with bio-inspired agents and randomly disseminated onto a virtual space. The loaded agents move on the virtual space in order to form a group following the flocking algorithm. The agents group on the basis of a predefined concept of similarity of their associated objects. Only the agents associated to similar objects form a flock, whereas the agents associated with objects dissimilar to each other do not group in flocks. Anomalies are objects associated with isolated agents or objects associated with agents belonging to flocks having a few number of elements. Swarm intelligence features of the approach, such as adaptivity, parallelism, asynchronism, and decentralization, make the algorithm scalable to very large data sets and very large distributed systems. Experimental results for real and synthetic datasets confirm the validity of the proposed model.