The land now called Normandy had been given to a group of northern European settlers (hence the name) by the king of France to whom they swore fealty.
In the 11th century, wanting to expand his land further, Duke William of Normandy crossed the channel and conquered England, crowning himself king. This would put him in the awkward situation of being both a sovereign in England, and thus equal to the king of France, but still a vassal of the later in regard to his continental possessions.
Three hundred years later, the king of France died without a male heir and William's descendants felt that they had unjustly been sidetracked from the line of succession when the continental nobility invoked the Salic law to discredit their claim.
In a conflict that came to be known as the "War of French Succession", the Normands and their allies tried to forcefully take over France. Both they and their opponents had a series of victories and defeats but no clear victory emerged for either side. After a thruce was called and discussions were made, a treaty was agreed upon whereby the Normands would renounced their claim to the french throne in exchange for which the new king of France would recognise the Normands holdings on continental Europe and the Kingdom of Normandy, freed of its vassal state.
Now King of two kingdoms, the Anglo-Normand monarch toyed with the idea of simply uniting both of them but resistance from local barons meant that although being in personal union through their king, they remained separate countries with their own institutions.