In a currency swap, institutions will enter into an arrangement lasting anywhere from 1 to 30 years, in which they loan each other an equal principal amount at the current exchange rate, lending out their currency and taking a loan in a foreign currency, and paying an interest rate in foreign currency to their lending counter-party.
Institutions that engage in a currency swap (also called a cross-currency swap) seek to increase their exposure or liquidity in a foreign currency, and in some cases seek to take advantage of favorable interest rates in the arrangement. In fact, a currency swap can be considered a variation on an interest rate swap, except that in this case, a notional principal is exchanged at the onset.
During the course of the arrangement, interest payments are paid to the lenders at different rates. Usually one will pay a fixed rate and one will pay a floating rate, with the interest payments made in the borrowed currency.
At the end of the arrangement, which might be between 1 and 30 years, the principal amounts are swapped back, at the original spot rate, which gives it an element of risk (since the exchange rate may have changed dramatically in that period). These arrangements are done Over the Counter (OTC) and are not transacted on a formal exchange.
One reason a company may elect the currency swap route is to reduce the costs associated with borrowing from a foreign bank if they need to fund new expansions into that country: by finding a company in that country to swap currencies with, they both might reduce their interest payments dramatically. A banking or investment institution might use these regularly as a currency hedge.
To note: an FX swap is a similar arrangement for a shorter time frame, but there are no interest payments and the amounts exchanged at the end of the arrangement are different than the original amounts swapped.