The Macintosh HD may be encrypted by FileVault. Besides, the Macintosh HD could be encrypted when you format it with file format such as APFS(Encrypted), Mac OS Extended(Journaled Encrypted), etc. You must use the correct password to unlock the drive so that you can proceed to recover data from the drive with data recovery software.
FileVault is Apple's full-drive encryption method for macOS. It protects the drive from unauthorized access. During the setup process, you are asked to choose either Allow my iCloud account to unlock my disk or Create a recovery key and do not use my iCloud account. Different options decide the way you disable FileVault on Mac.
Perhaps, you choose the file format that can encrypt the drive when erasing it in Disk Utility as Mac OS Extended and APFS provide such options, then you need to enter the password to decrypt it. Try to recall the password or where you saved it.
Have you ever encrypted Macintosh HD with any third-party software? If so, you'd better disable the encryption with the corresponding app and then attempt to recover data from the drive.
If you can't recall and find the password to decrypt the drive, the whole drive is inaccessible, then any third-party data recovery software can recover data from it. If you have backed up the files with Time Machine, you may give it a shot.