They serve very different purposes and are not interchangeable.
A backup solution creates independent copies of your entire M365 environment, including data, files, emails and Teams chats, that can be restored if something is lost, deleted, encrypted or destroyed. It is your safety net in a disaster scenario.
Retention policies are a compliance tool. They define how long content must be kept or must be deleted, helping you meet regulatory requirements around data governance.
There are two settings: retain content (preventing permanent deletion and keeping it available for eDiscovery) and delete content (permanently removing it from your organisation). A retention policy can prevent content from being permanently deleted, but it is not a backup. It does not protect you from ransomware, provide a point-in-time snapshot to restore from or replace the ability to recover your environment after an incident. Both are valuable in a well-governed M365 environment, but they serve different purposes.