What is this brown flexible wire with 5 sliding pieces? This is definitely one of the strangest LEGO pieces I've ever found.



The wire caps are both stamped LEGO, one would take half (or quarter) a pin and one a small ball.

What is it and where does it come from?
That's a flex system cable with several clutch changeover elements strung onto it. You can see it on the back of 8002 Destroyer Droid:



That's the only set with those parts in brown, so that's certainly where it came from. You can find all of the parts in the set inventory.

Those cable end elements have never felt quite like LEGO bricks to me, as they are one of the few parts that I feel like I might break when taking them apart.