a politician who takes up residence in a place and runs for office without having strong ties to the area.
Yes, the origin of the definition is from the post Civil War for Northeners joining the GOP and moving to the south for political reasons, but now has come to mean anyone moving to a new place just to run for office.
https://www.dictionary.com/browse/carpetbagger