Eggs, sugar and a Portuguese theory
Possibly Portuguese in idea, certainly Malay in flavour, and made famous by the Hainanese.
Nobody recorded the invention of kaya. The most often repeated theory connects it to the Portuguese, who ruled Malacca from 1511 and who brought with them a love of sweets made from egg yolks and sugar. In Portugal those sweets are bound with nothing else. In Malacca, the theory goes, local cooks replaced what they lacked with what they had: coconut milk for richness, pandan for scent.
The idea fits. Egg and sugar confections with Portuguese ancestry are found wherever the Portuguese traded in Asia, from Goa to Thailand to Japan. It is not proven.

The family
Kaya has relations all round the region whose names echo it. Thailand has sangkhaya, a steamed coconut custard, served on sticky rice or inside a pumpkin. Indonesia has srikaya. Thai tradition credits its egg sweets to a woman of Portuguese descent at the seventeenth-century court of Ayutthaya, which is one more thread tying the whole family to Portugal.
The Malay and Peranakan kaya differs from these in being stirred to a jam, not steamed to a set custard.
Three contributors
A sweet thickened with eggs alone, as in the convent sweets of Portugal.
Coconut milk and pandan leaf, the base of the region’s desserts.
Spread on bread in place of British jam. This made it famous.
From kueh to breakfast
For most of its history kaya was eaten with glutinous rice and as a layer on kueh, in Malay and Peranakan homes. It was the Hainanese coffee-shop keepers of the early twentieth century who put it on toast. They had learned to make toast and jam for British employers; in their own shops they used the local jam, which was cheaper and which their customers preferred.
Where it is eaten
On toast, in buns and puffs, with glutinous rice.
Steamed, or as a green dip for bread.
A spread and a custard.
A cousin without eggs.