Why am I losing this title?
I am playing CK2 with my friends in the Byzantine Empire. He is the emperor while I picked a duke in the kingdom. When he got enough money, he then created the Kingdom of Greece and gave it to me. But now, even though I have Agnatic-Cognatic Primogeniture, and I have a son, my friend (the emperor) is the still the heir to my kingdom. What can I do to fix this?
EDIT: Any time I give away a title like a dutchy, I'm am the heir for title.
Solution 1:
The title in question is a viceroyalty. Viceroyalties were added in the Charlemagne DLC and are less permanent titles used by The Byzantines (and other empireswith high legalism tech).
Viceroyalties are not inherited on death. Instead, the title returns to your liege who can give it to someone else.
To grant you a permanent title, your friend needs to grant it with the "grant landed title" button rather than the "grant viceroyalty" button. However, your friend probably already knows this.