macOS Mojave is macOS 10.14. Then there’s macOS 10.15, macOS 11, macOS 12, and macOS Ventura is macOS 13.
You need to free up more SSD storage space for the macOS 13 upgrade. That is what the error is referring to. Your main storage is too full. Move some files elsewhere, or delete some files you no longer need.
Have backups before you start the cleanup and the upgrade.
Your RAM memory will be tight, but it’ll probably work (depending on whether this Mac is overloaded, and by how much), particularly given the SSDs used in MacBook Pro circa 2017 are decently fast.
For the downgrade referenced in the title, and which is likely not what you intend…
macOS 10.12 to macOS 13 for the three 2017 models, probably.
You will need to erase and re-install to move to an older version.
Your documents and music files and such will probably transfer fine (manually), but any version-specific files, and photo and music libraries and such, won’t downgrade. There’s no automated migration of settings and the rest of user data from newer to older versions. It is a manual process.