Present-day ecosystems host a huge variety of organisms that interact and transfer mass and energy via a cascade of trophic levels. When and how this complex machinery was established remains largely unknown. Although exceptionally preserved biotas clearly show that Early Cambrian animals had already acquired functionalities that enabled them to exploit a wide range of food resources, there is scant direct evidence concerning their diet and exact trophic relationships. Here I describe the gut contents of Ottoia prolifica, an abundant priapulid worm from the middle Cambrian (Stage 5) Burgess Shale biota. I identify the undigested exoskeletal remains of a wide range of small invertebrates that lived at or near the water sediment interface such as hyolithids, brachiopods, different types of arthropods, polychaetes and wiwaxiids. This set of direct fossil evidence allows the first detailed reconstruction of the diet of a 505-million-year-old animal. Ottoia was a dietary generalist and had no strict feeding regime. It fed on both living individuals and decaying organic matter present in its habitat. The feeding behavior of Ottoia was remarkably simple, reduced to the transit of food through an eversible pharynx and a tubular gut with limited physical breakdown and no storage. The recognition of generalist feeding strategies, exemplified by Ottoia, reveals key-aspects of modern-style trophic complexity in the immediate aftermath of the Cambrian explosion. It also shows that the middle Cambrian ecosystem was already too complex to be understood in terms of simple linear dynamics and unique pathways.