As others have said the key property is the time-reversibility of emission/absorption process. Lets say someone asks the analogous question "how can a good absorber of heat be a good absorber of cold?".
A good heat absorber has a high thermal conductance, and good
thermal contact with whatever its supposed to absorb heat from.
A good cold absorber has exactly the same properties.
So good cold absorbers are also good heat absorbers, which one they act like is just a matter of whether they are hotter or colder than the other thing. You know this from everyday life, cold water makes you freeze faster than cold air and hot water makes you burn (boil) faster than hot air.
The emission and absorption of radiation is similar. Things that are white, or reflective (mirrors) have a very weak thermal coupling to the radiation field, its like they are separated from it by jacket. Things that are black have a very strong coupling to the radiation field, so they reach thermal equilibrium with it much faster.
A good experiment to try is this.
Sunlight has a temperature of about 6,000 degrees C, while even on a hot day the air will be much cooler than that. If you put a white and a black object out in the sun both will find a compromise temperature where the sun heating them and the air cooling them balances - the black one has better sun-contact so will end up hotter.
You can then repeat the same experiment at night (find somewhere very dark, no streetlights ideally). Now the light-field is (if its dark enough) really, really cold: about -270 degrees C (a bit above absolute zero, cosmic microwave background), so the air is now the heat source and the light the cold. Correspondingly the black object will become colder than the white one.
You can make the experiment better by trying to put a shield of some kind so that the white/black things are only interacting with light from space, ideally no infra red from the ground nearby.