Currency exchange: Airport, my country, or Spain?
If you come from a country outside the European Union you will have to change money to get euros, either in your city of origin or at your destination. It is possible that you have thought about using the credit card during the trip and until you can withdraw cash, however, it is highly recommended that you carry some cash in the currency of the country in case unforeseen events occur. You have several options to change the currency:
Airport: as soon as you arrive at the airport, you will find several places that offer currency exchange. They usually charge higher commissions than banks, but you can leave the airport with cash since they will give you the money at that moment.
Home country: while you organize the trip, you can ask your bank to change a certain amount of money. This is the cheapest way but the one that will take you the most time. In each bank, the commission costs will be different, but you will carry cash with you from the start of the trip and, once you arrive in Spain, you will not have to worry about it.
Destination city: once you move from the airport to the city center, you can go to several places where they exchange cash. The best thing is that you can do it with ease during your stay, the downside is that you won't have euros until you get to the city center.
Another option that you can consider is to combine some of the options: for example, you can ask for a small amount of cash in your country to bring something with you and ask for the rest in the destination city.
If you have already arrived in Madrid and the money you have brought in cash is in the currency of your country of origin, you can change to Euros in the city without any problem, and you have several options for this:
Offices: the same offices that you can find at the airport can also be found in the center of Madrid, there are many different companies that offer these services. These offices are very efficient and fast, they exchange more than 80 foreign currencies, accept credit cards and money transfers and, in some cases, even advance cash. Also, if you have cash left over when you go back to your country, these offices buy the leftover money so you won't have to keep making changes and paperwork when you get back home.
ATMs: this option is available 24 hours a day. You can access currency exchange ATMs to exchange your money for euros or you can access ATMs at any bank branch and withdraw cash with a credit card. Inform yourself before to find out the place and the way in which they charge you less commissions.
Local banks: it is possible that the commissions this way are lower, but it is also possible that it is a longer and more tedious process than the previous ones since it involves several procedures. You will have to inform yourself at the bank itself and they may give you the money right away or you may have to wait a few days, it will probably depend on the amount of money you need.