3D supergravity from wrapped M5-branes