'Efendi' in Turkish today holds a similar place to 'Sir' or 'Ma'am' in English. 'Beyefendi' and 'Hanimefendi' respectively mean 'Sir' and 'Ma'am'. 'Efendi' also means master in a hierarchical sense. For example, 'Lord' in 'Lord of the Rings' gets translated as 'Efendi'.
There was no formal process. Efendi is not a title per se, it is rather a honorific that accompanies certain real titles.
Efendi comes from Byzantine Greek afthendis (αυθέντης), meaning lord or master. The word entered Turkish via it's colloquial vocative form (afendi). The term was already in use in Turkish Anatolia during 13^(th) century, i.e. before the Ottoman Empire came to be. In such a way the daughter of famous poet Rumi was referred to Efendipoulo (the Master's daughter, as witnessed by Eflaki). Ibn Battuta witnessed that a brother of the ruler of Kastamonu was called Efendi.
The term entered Ottoman chancery from the very beginning. Ahikpashazade witnessed that Kara Rustem addressed kadiasker Candarlı Halil as efendi. In a number of his fermans written in Greek, Sultan Mehmed II used the title of "ο μέγας αυθέντης" (Grand Signor). From the late 15^(th) century onward, the term was frequently used for various dignitaries. In 16th century there were some suspicions about use of the term, due to it's infidel origins (as witnessed by Grand Mufti Ebusuud.
Frequency of use of efendi increased during the 16^(th) century. In this period it was used to designate scribal and religious functionaries, as opposed to the military ones. Efendi even became a part of some titles. In such way reisülküttab got the alternatıve title of reis efendi, the kadi of Istanbul became known as İstanbul efendisi, and the chief secretary of the jannisaries got the title of yeniçeri efendisi. The title was used to speak of the sultan or Muhammad as Efendimiz (Our Lord). The subjects in Egypt used the Arabicized form of efendimiz (efendiinaa) to speak of Muhammad Ali and his successors. Turkish-speaking Christians used the title of Efendimiz to refer to Jesus Christ.
During the 19^(th) century the Ottoman government tried to regulate use of efendi by law. It was given to the princes of the royal house, sheikh ul-islam, members of the ulema and heads of other religions, as well as people of similar high ranks. During that time it was increasingly used following the personal name, as a form of address, for all people excluding those who had the rank of bey (primarily military functionaries). Thus it came to be regarded as the approximate translation of English mister.
In the records of the first Ottoman parliament of 1877, nearly all deputies were designated as either efendi or bey. The speakers adressed the house as efendiler (pl. form of efendi). The title was finally abolished in 1934. It survived in modern Turkish in the form of efendim, beyefendim or hanımefendim.
In the Arab countries, the title of efendi was introduced during the 19^(th) century. There it came to be regarded as the title of secular educated townspeople that followed European style of clothing, against lower classes and men of religion (whereas it got increasingly religious connotation in the 19^(th) century Anadolia). It became a rough translation of mister in Arabic as well, but is constantly losing ground against autochthonous Arabic title of sayyid.
u/GrandDragoman's answer is fantastic, and here are two Ottoman-era the dictionary definitions to compliment it:
efendi (. .' .) افندی Gk 1. gentleman; gentlemanly. 2. master. 3 Ott. hist., title given to literate people, members of the Clergy, Ottoman princes, army officers up to major. (Redhouse, Turkish-English Dictionary)
efendi R. 1. sâhib, mâlik, molla: uşağın, bahçevanın efendisi 2. seyyid, çelebi, hoca. [ta'zîm unvânı olup, başlıca okumuşlara ve ulema ile erbâb-ı kaleme mahsûstur. ağa makabli] Ahmed efendi, hoca efendi, kâtib efendi. (Şemsettin Sâmi, Kamûs-ı Türki)
Both definitions show that it had various uses, mostly centered around showing respect to the person in question rather than being a formal title.