Answer by taking a quote from the following article:

Domenikos Theotokopoulos (Greek: Domenikos Theotokopoulos [do'minikos theoto'kopulos]; 1541 -  7 April 1614), most widely known as El Greco ("The Greek"), was a painter, sculptor and architect of the Spanish Renaissance. "El Greco" was a nickname, a reference to his Greek origin, and the artist normally signed his paintings with his full birth name in Greek letters, Domenikos Theotokopoulos (Domenikos Theotokopoulos), often adding the word Kres (Kres, "Cretan"). El Greco was born in the Kingdom of Candia, which was at that time part of the Republic of Venice, and the center of Post-Byzantine art.

In 1577, El Greco migrated to Madrid, then to Toledo, where he produced his mature works. At the time, Toledo was the religious capital of Spain and a populous city with "an illustrious past, a prosperous present and an uncertain future". In Rome, El Greco had earned the respect of some intellectuals, but was also facing the hostility of certain art critics. During the 1570s the huge monastery-palace of El Escorial was still under construction and Philip II of Spain was experiencing difficulties in finding good artists for the many large paintings required to decorate it. Titian was dead, and Tintoretto, Veronese and Anthonis Mor all refused to come to Spain. Philip had to rely on the lesser talent of Juan Fernandez de Navarrete, of whose gravedad y decoro ("seriousness and decorum") the king approved. However, Fernandez died in 1579; the moment should have been ideal for El Greco.  Through Clovio and Orsini, El Greco met Benito Arias Montano, a Spanish humanist and agent of Philip; Pedro Chacon, a clergyman; and Luis de Castilla, son of Diego de Castilla, the dean of the Cathedral of Toledo. El Greco's friendship with Castilla would secure his first large commissions in Toledo. He arrived in Toledo by July 1577, and signed contracts for a group of paintings that was to adorn the church of Santo Domingo el Antiguo in Toledo and for the renowned El Espolio. By September 1579 he had completed nine paintings for Santo Domingo, including The Trinity and The Assumption of the Virgin. These works would establish the painter's reputation in Toledo.  El Greco did not plan to settle permanently in Toledo, since his final aim was to win the favor of Philip and make his mark in his court. Indeed, he did manage to secure two important commissions from the monarch: Allegory of the Holy League and Martyrdom of St. Maurice. However, the king did not like these works and placed the St Maurice altarpiece in the chapter-house rather than the intended chapel. He gave no further commissions to El Greco. The exact reasons for the king's dissatisfaction remain unclear. Some scholars have suggested that Philip did not like the inclusion of living persons in a religious scene; some others that El Greco's works violated a basic rule of the Counter-Reformation, namely that in the image the content was paramount rather than the style. Philip took a close interest in his artistic commissions, and had very decided tastes; a long sought-after sculpted Crucifixion by Benvenuto Cellini also failed to please when it arrived, and was likewise exiled to a less prominent place. Philip's next experiment, with Federico Zuccari was even less successful. In any case, Philip's dissatisfaction ended any hopes of royal patronage El Greco may have had.

what did he do in toledo?
signed contracts for a group of paintings that was to adorn