Why is zeroing out a drive with dd not working? I'm using macOS Catalina.
I have a 16GB microSD card that had Raspbian on it, which is 2 partitions:

45MB boot partition
large Linux partition

I needed to clear it, so I plugged the SD card into my Mac and did this:
$ sudo bash -c 'gdd if=/dev/zero of=/dev/rdisk2 bs=4M; sync'

gdd is the GNU version of dd, installed using homebrew.
/dev/disk2 is definitely the right microSD card I'm zeroing out, confirmed with the Disk Utility.
I use rdisk instead of disk because it's much faster, and points to the same disk.
When the command starts running, the macOS Disk Utility shows the drive name change from &quot;boot&quot; to something like &quot;Generic Flash Device&quot; or something like that, so I know it's definitely doing something.
gdd runs for a while, and after a few minutes, shows this:
gdd: error writing '/dev/rdisk2': Input/output error
3799+0 records in
3798+0 records out
15931539456 bytes (16 GB, 15 GiB) copied, 419.932 s, 37.9 MB/s

The error makes sense, since it tries to write zeroes to the microSD card until it runs out of space. At this point, the SD card should contain all zeroes. I've done this literally dozens of times on Linux. It never fails. I've even done this successfully on High Sierra dozens of times.
What doesn't make sense to me is that as soon as the gdd process is done running, Disk Utility shows the SD card as &quot;boot&quot; again, it automounts at /Volumes/boot, and the files are still there.
How is it that gdd shows that it successfully wrote the entire SD card full of zeros, and yet the data is still there?
Update: The Mac I was doing this on just happened to have VMware fusion on it, so I did this:

Created a VM, attached Arch Linux ISO to it, and booted it
Attached the USB card reader device to the VM
Used dd in Arch to zero out the drive

I shut down the VM, and the USB device reattached to the macOS. Exactly the same thing - the &quot;boot&quot; partition is still there, still auto-mounts, and has all the files there. What is going on?
Update 2: I can't even seem to delete the partitions. I use the Arch VM, and either fdisk, or cfdisk to delete the 2 partitions on the SD card, it says it deleted them successfully, but as soon as I check again, the partitions are still there. The SD card is brand new. I'm not seeing any I/O errors reading from, or writing to it that would even suggest that its damaged.
Update 3: I can't even delete the files. I mount either partition under Arch, use rm -rf * to delete ALL files on that partition, and ls shows that they are gone. I unmount the partition, and immediately mount it again, and all the files are still there.
The error makes sense, since it tries to write zeroes to the microSD card until it runs out of space.

You've misread the error.
gdd: error writing '/dev/rdisk2': Input/output error

That means there was an error writing to the device.  The command you issued should do what you want - fill the drive with zeros, but this error says otherwise.

What doesn't make sense to me is that as soon as the gdd process is done running, Disk Utility shows the SD card as &quot;boot&quot; again, it automounts at /Volumes/boot, and the files are still there. How is it that gdd shows that it successfully wrote the entire SD card full of zeros, and yet the data is still there?

gdd did no such thing!  It gave you an I/O error message when it was writing to the device.  Your original files are there because nothing was written to the SD card.
Possible causes:

The card could be write protected
The card could be defective (especially if counterfeit - i.e. it reports 16GB but only has 2GB of actual storage)
The USB card reader could be defective