As Rudegar said, try if installing Rosetta helps.
If not, try to reset and re-install from scratch:
(*)Install HP LaserJet P1005 printer in macOS 10.11.6 El Capitan - macOS 10.15 Catalina.
(**)Install HP LaserJet P1005 printer in macOS 11 Big Sur - macOS 27 Golden Gate.
Works with HP LaserJet P1005 and reportedly also with:
HP LaserJet 1018
HP LaserJet 1022
HP LaserJet P1505
HP LaserJet 4050N
HP LaserJet Pro M1132
0. As always do a backup, just in case!
1. Connect HP LaserJet P1005 printer via USB to the Mac and turn it ON.
2a. Download and install HewlettPackardPrinterDrivers.dmg from Apple Support (works on macOS 10.11.6 El Capitan - macOS 10.15 Catalina, (**)for newer macOS see below):
-> HewlettPackardPrinterDrivers.dmg
HP 5.1.1 Printer Software Update - Apple Support
(*)That installer works on macOS 10.11.6 El Capitan - macOS 10.15 Catalina.
2b. (**)In macOS 11-27 Big Sur - Golden Gate you must install those drivers via Pacifist 4 (free demo -- I'd suggest paying ≈$24€ if it works for this...) because the old installer does not work in newer macOS ("This update requires macOS version 15.0 or earlier.").
https://www.charlessoft.com
Pacifist > File > Open Package... > [choose HewlettPackardPrinterDrivers.dmg] > [select "HewlettPackardPrinterDrivers.pkg"] > File > Install Files to Default Locations > [authenticate, and if prompted, Replace (or Update) all files that already exist]
(Or: Mount HewlettPackardPrinterDrivers.dmg by double-clicking it in the Finder, and Pacifist > File > Open Package... > [select "HewlettPackardPrinterDrivers.pkg" on the mounted HewlettPackardPrinterDrivers.dmg] > File > Install Files to Default Locations > [authenticate, and if prompted, Replace (or Update) all files that already exist])
3. System Settings/Preferences > Printers & Scanners > [optionally or when troubleshooting ctrl-click "No Printers" entry (Sonoma and later) or in the left panel (earlier macOS) and choose "Reset printing system..."] > Add Printer, Scanner, or Fax... or + > click "HP LaserJet P1005" > Use: "HP LaserJet P1005, 1.6.1" > OK > "Add" the printer > OK.
4. In M series Macs up to Golden Gate 27 (not possible in macOS 28 anymore) you must install Rosetta if it isn't already installed because otherwise printing fails with "Stopped "Data" failed". You can do that by opening '/Library/Image Capture/Devices/HPScanner.app' which is an Intel app. After doing that you might need to re-do step #3. Another option is to install Rosetta via the Terminal:
softwareupdate --install-rosetta
Using Intel-based apps on a Mac with Apple silicon - Apple Support
Repeat step #3 if the printer stops working after some macOS update.
When troubleshooting you might try to start from scratch: Delete /Library/Printers folder. Click the Printer in Settings/Preferences > Printers & Scanners and choose "Remove Printer...". ctrl-click the Printers area in Settings/Preferences > Printers & Scanners and choose "Reset printing system..." -- that re-creates /Library/Printers folder in its default state. You might also delete '/Library/Image Capture/Devices/HP*' files. Then reboot and try #1-4 again.
2c. (**)Or, remove version checks from the installer:
Mount HewlettPackardPrinterDrivers.dmg, and then via the Terminal expand its contents to the Desktop (pkgutil needs a non-existant directory as destination so there is no "Error 17: File exists" error):
pkgutil --expand /Volumes/HP_PrinterSupportManual/HewlettPackardPrinterDrivers.pkg ~/Desktop/expanded_folder
Then open ~/Desktop/expanded_folder/Distribution file with a text editor like BBEdit, and enable Line numbers. Then edit it:
Add new line after opening bracket { on line 15 and write "return true;" there.
(Or: change both instances of '15.0' to something like '99.0' in the InstallationCheck function)

Then save the ~/Desktop/expanded_folder/Distribution file.
Then save the edited package and install it:
pkgutil --flatten ~/Desktop/expanded_folder ~/Desktop/HewlettPackardPrinterDrivers_edited.pkg
Then connect HP LaserJet P1005 printer via USB and turn it ON.
Apply the edited installer HewlettPackardPrinterDrivers_edited.pkg and:
System Settings/Preferences > Printers & Scanners > [optionally or when troubleshooting ctrl-click "No Printers" entry (Sonoma and later) or in the left panel (earlier macOS) and choose "Reset printing system..."] > Add Printer, Scanner, or Fax... or + > click "HP LaserJet P1005" > Use: "HP LaserJet P1005, 1.6.1" > OK > "Add" the printer > OK.
HP p1005 laserjet printer driver install … - Apple Community