A scheme to utilize atom-like emitters coupled to nanophotonic waveguides is proposed for the generation of many-body entangled states and for the reversible mapping of these states of matter to photonic states of an optical pulse in the waveguide. Our protocol makes use of decoherence-free subspaces (DFS) for the atomic emitters with coherent evolution within the DFS enforced by strong dissipative coupling to the waveguide. By switching from subradiant to superradiant states, entangled atomic states are mapped to photonic states with high fidelity. An implementation using ultracold atoms coupled to a photonic crystal waveguide is discussed.