Photonic simulation of entanglement generation and transfer in a spin chain