How do I erase the memory of the Arduino Uno?
When booted, the Arduino will run whatever program was put on it last. Solution: Don't turn it on if you don't want it to run.

When out of the box, the Arduino usually runs the Blink program. So you can just load that and call it a day if you want to "reset" it.

Or have a loop program with a sleep command.

If you've been messing with the USB bootloader via the icsp pins, this isn't enough though, you'll need to reinstall the bootloader. But if you've been uploading programs via usb or directly using a programmer, there is no issue with uploading Blink or some other dummy program to reset it.