Madrid has derived its name from several theories. Legend says Ocno Bianor-Son of King Tyrrhenius of Tuscany and Mantua, was the founder of Madrid. He named Madrid as "Metragirta" or "Mantua Carpetana". Whereas others argue that Madrid has derived its name from a Latin word "Ursaria" which means land of Bears. These animals are found in large numbers in the forests adjacent to the city. These animals accompanying the Strawberry tree are depicted on the emblem of Madrid since middle ages.
However, it has become a common belief that the city has derived its current name since the 2nd century B.C. This is a period when the Roman Empire established a settlement on the banks of the river Manzanares. With reference to the river that crossed the settlement, they named the village as "Matrice". During the 5th century A.D. when the Germanic Sueves, Vandals and the non-Germanic Alans entered the area, the situation became difficult for the Roman Empire to defend its territories on the Iberian Peninsula. It therefore was ruled by the Visigoths. Subsequently, the control of Matrice went in the hands of the Barbarian Tribes.
Further, the name was changed to Mayrit from the Arabic term Mayra during the 7th century. This change was noticed by the Islamic Conquest of the Iberian Peninsula.
The current name "Madrid" evolved from the Mozarabic "Matrit", which is still in the Madrilenian gentilic.
The territory of Madrid was owned by the Diocese of Complutum-currently Alcala de Henares during the Roman Era. There still exist archaeological remains of a small village during the Visigoths Era. The Arabs might have then adopted its name. During the 9th century, Muhammad-I built a small palace in the same place. This place is today occupied by the Palacio Real. This is the time when the modern city started to expand. Further, a citadel called al-Mudaina was built. The river Manzanares flows just besides that palace. The Muslims called it as al-Majrit which means source of water. The site thus achieved its origin as Majerit. This later evolved into the modern-day spelling "Madrid".
In 1085, the citadel was conquered by the Christian king named Alfonso VI of Castile. This mosque was then reconsecrated as the church of the Virgin of almudena. Further, in 1329, the Cortes Generales first assembled in the city to advise Alfonso XI of Castile.
Later in the 15th Century, the Sephardi Jews and Moors resided in the city until they were expelled. After so much of hardships, Henry III of Castile (1379–1406) rebuilt the city in E1 Pardo. The strife between Castile and argon came to an end when the Catholic Monarchs-King Ferdinand II of Argon and Queen Isabella of Castile entered Madrid.
In 1561 Philip II (1527–1598) shifted the court to Madrid for which no official declarations were made by Philip II. The seat of the court was the de facto capital. Holy Roman Emperor & Philip's father, Charles I of Spain favored 'Seville'. Seville continued to control commerce with Spain's colonies, but Seville was controlled by Madrid.
During the period 1601-1606, Felipe III ruled through his court in Valladolid. During the Golden Century (16th & 17th century) Madrid resembled other European capitals. This happened as the commerce was revolving around the business of court only. Most of the population of the city was economically dependent on such businesses. Apart from these there were no other significant activities.
Madrid's origin can be traced to Arab Emir Mohamed I (852-886). He constructed a fortress on the left bank of the Manzanares River. This wall later became the reason of dispute between the Christians and Arabs. In the 11th century, Alonso VI conquered the wall and the dispute was settled. During the 18th century, Carlos III designed the great arteries like Paseo del Prado and Paseo las Acacias.
In 19th century, Joseph Bonaparte started the reformation of the Puerta Del Sol and vicinity. Under his reign an east-west Avenue, the commercial street known as the Gran Via was constructed. In the 1950's the Paseo de la Castellana, a north-south corridor was extended and modern buildings were raised housing the major financial institutions.
Isabel II in the late 1800s was not able to suppress the political tensions that lead to yet another rebellion, the First Spanish Republic. Later, followed by the return of the monarchy to Madrid second Spanish Republic took place preceding the Spanish Civil War.
During the Civil War (1936–1939) Madrid was one of the most heavily affected cities of Spain. Since then Madrid continued to be a stronghold of the Republicans. Western Madrid suburbs were bombed by airplanes targeting civilians.
During the 1960s, under the dictatorship of Francisco Franco, the south of Madrid became very industrialized attracting migrations from rural areas of Spain into the city. These migrated people provided the base for an active cultural and political reform.
After the death of Franco, democratic parties, left-wing and parties with republican ideology accepted King Juan Carlos I as the heir of the historic dynasty. This political move helped Spain to secure stability and democracy. There after Spain earned its current position as a constitutional monarchy, with Madrid as capital.
During the 1980s and 1990s, the capital city of Spain earned its position as an important economic, cultural, industrial, educational, and technological center of the European continent.