To be honest the are both very similar.
I do not quite understand how holybro came up with the name… (I dont know of an official pixhawk 3)… but anyways lets ignore the numbers
Pixhawk 2.1 is abit older, but in my opinion is still abit better (because the IMU has more redundancy) and in general the cube (sensor module) is manufactured/designed to a high standard with lots of features to ensure it works well. But the PH 2.1 system is still the most expensive pixhawk system on the market.
THe Pixhawk 4, is by no means a bad product and hollybro make and design excellent products. But as I wrote in my preview, I feel this is more like an upgraded pixhawk v1. I say this because t is small, and still affordable, and does not add any revolutionary new thing (like the imu cube on the ph2.1). So ultimately between the two it is just a matter of your own preference.
I would say if you need something small, or that gives you more bang of the buck, the Pixhawk 4 is your best option. But if you are flying something particularly expensive (like a fancy camera), then spending abit more to get the extra redundancy that Pixhawk 2.1 offers is worth spending the extra money.
At the end of the day both boards run the same firmware, so its just a slight hardware variatiion/sensor choise between them.
Hope this helps