Xu competed for China at the 2012 Summer Olympics, and won a silver medal in the 100 metre backstroke at the 2016 Summer Olympics. He also won a silver medal in the 4x100 mixed medley at the 2020 Summer Olympics.