The Royal Family has a large "pool" of personal Royal Titles that the Sovreign can bestow on any member of the Royal Family.
The last(and 1st) Duke of Edinburgh (before Phillip)was
Alfred Ernest Albert Saxe-Coburg and Gotha, Duke of Edinburgh
one of the sons of Queen Victoria,when he died(he only had daughters surviving him) the title went into abeyance until it was used for Phillip.
When Phillip dies it will go into abeyance again.
Prince Edward is believed to have chosen his title himself,The last person to hold the title Earl of Wessex was Harold Godwinson, prior to his accession to the English throne in 1066
I don't know quite how many titles the Royal Family "own"but it is believed to run into hundreds!