Start with understanding, not rewriting. Ask the AI to explain a module, map what depends on it and list the behaviours it seems to have. Then have it write tests that pin down what the code does today, before you change anything. Those tests are your safety net.
Work in small slices, such as one function or file per change, with a human review and a test run each time. AI is good at dull jobs like documenting, renaming, upgrading libraries and removing dead code. Keep architecture and risk decisions with your team. Also write a short guide to your conventions for the AI to read. Well-documented code gives better AI output too.