Arduino nano(clone) uploading code but not running it

I would recommend using the 3rd party MiniCore boards platform to add support to Arduino IDE for the ATmega328PB:

https://github.com/MCUdude/MiniCore#boards-manager-installation