While it is true that naming a hostile or passive mob prevents it from being counted towards the mob cap (same goes for mobs holding items they picked up) I don't think the same applies to villagers because they do not spawn the same way and they do not count towards any other cap, passive or otherwise (they are their own category of mob). Otherwise, the only reason to name a villager is so you can tell them apart or just for fun.
for my iron farm i used name villagers hoping that it would lessen the entity count in the area, but i don't know if this is why my iron farm is not working can anyone give me info on this.
Naming them should not affect the iron farm. If it's not spawning golems, there's a different reason; most likely, there are not 21 registered houses (ie doors with more sky-light on one side than the other).