if you look closely at the andalusian duchies and counties you can see that they are vassals of your imperial title (upper right corner of the county panel, you can see the county CoA next to the duchy CoA and the imperial CoA), and since they already are in dejure spain they won't drift into any of your kingdoms. if you give a duke who currently is a vassal of any your king titles land in andalusia it will drift into the dukes dejure kingdom.
For example, the duke of leon gets the duchy of sevilla. He is a dejure vassal to the leonese crown, and sevillia is now part of his ducky. Thus sevilla is part of leon and it will drift towards it.