If this if for your iMac 21.5", you should be able to just erase the disk and reinstall macOS to set it back up as new.
Since that iMac model is powered by Intel and doesn't have a T2 security chip, it shouldn't support Activation Lock so the owner's Apple ID shouldn't be saved anywhere that you can't remove it from via disk erasure.
To erase the disk:
- Open macOS Recovery on an Intel-based Mac (click the hyperlink for directions on how)
- Open Disk Utility.
- Click "View" in the Menu Bar and select "Show All Devices."
- Select the computer's main disk (it'll probably be called "APPLE SSD"/"APPLE HDD" followed by a string of seemingly random characters).
- Click "Erase" in the top right corner. In the dialogue window, give the disk a name and select "Mac OS Extended (Journaled)" for the Format and "GUID Partition Map" for the Scheme.
- Let your disk finish erasure and re-formatting. This may take a while. Once you see a dialogue window with a green check mark letting you know the process is complete, click "Disk Utility" in the Menu Bar and then "Quit."
To reinstall macOS:
- Open macOS Recovery on an Intel-based Mac (if you followed Step 6 above, skip this step).
- Open Reinstall macOS
- Click continue. If you agree to the Terms and Conditions you're presented with, click "Agree" or the right arrow button that may appear on-screen. Follow any prompts here.
- Once presented with the option to choose your installation target, choose the newly-erased partition we created earlier in Dish Utility.
- Continue and let macOS reinstall onto your chosen target disk.
- Once macOS is reinstalled, complete setup as normal.
Since this Mac model can't Activation Lock, you shouldn't experience any prompts for the previous owner's Apple ID information now that it's been erased.