Interesting, I’m not a French speaker but my Spanish is OK. Always thought it was rooted in “pelota” as ball - but after looking both meanings are accurate just one being a bit more literal
1630s, "a small body of soldiers acting together but separate from the main body of troops," from French peloton "platoon, group of people," literally "little ball" (15c.), hence, "agglomeration," diminutive of Old French pelote "ball" (see pellet).