I couldn't find this info anywhere, so I'll mention it here:
I have bunch of animals, specially a good amount of rats, but this one special rat, is marked as "friendly", what I mean is, its name is coloured blue. I check its social screen and it says this 6 year old rat has children, grandchildren and great grand children in my colony. So I imagine it once belonged to my huge herd of rats, but not now.
I can tame it, or hunt it.
Also, wild rats don't have names, but this one is called Rat 3 (in blue). BUT! I already have a Rat 3 in my colony. Could that have something to do with this confusion? What happened to this rat??
Could you have sold it to a trader at some point? Sometimes pawns and animals that were once part of your colony and left for whatever reason can return as npc's.
Oh yeah, I've sold a lot of rats to my neighbouring colonies. Could it be that rats come back on their own? Is it just visiting??
I'll try and tame it back to my farm anyways...
Now I see a Boomrat 3, with the same characteristics. Blue name, and colony descendance. I'm not sure if I ever sold boomrats...
Might have came with a Trade Caravan and bugged out maybe?
I don't think so. If a trade caravan came with a familiar rat I would notice. Also no one came in a while now. No, these guys are by themselves
Had a totally different thing happened once, that could be related to the mechanics stated in this tread:
traders came in my town and they had 2 wild boars to sell. These 2 were marked to be hunt as soon as they appeared, i suddenly unmarked them for hunting and it worked, then i tried to mark for hunt again but it was impossible like any animal owned by a faction.
My explanation is that animal leaving your base (alive) still exist as things and can get chosen to be part of a generated group and they keep their informations.
I'm pretty sure that any named entity (that includes tame animals) that visit your map at some point in the game is added to a pool of "active" NPCs. These NPCs are tracked to some extent, the game records their stats, age, health, relations to others etc. I assume the rat in question was added to this pool when you tamed it, then sold at some point. I have no idea how or why it came back to your map, but that would explain why it's named.