Dissecting the complex environment of a distant quasar with MUSE