I bring villagers to my compound but they keep going back to their village. Why is that?
I abduct villagers via minecart and take them to my place which has a bed and plenty of jobs but they keep going back to their village no matter how far it is.
Is there something I need to do?
Solution 1:
Break their original beds and workstations! Villagers claim one bed and one workstation each, and can go quite a way to return to them. Only if their originals are broken or inaccessible (and time for work or sleep came, respectively, and they failed to pathfind to them) - and there are new, unclaimed ones available, they'll take them.
Solution 2:
In addition to SF's excellent point, I would also suggest that you make sure at least one bed is quite close to the villager when you drop them off. I ran into this problem setting up two villages on islands, where the beach is much lower than the houses I had built, and villagers would always attempt to return to their villages or just roam randomly until I placed a bed on the beach.
When I placed a bed on the beach, they would instantly claim that bed upon leaving the boat, and then would eventually claim other beds when they wandered around looking for jobs (allowing me to bring other villagers using the same method).