.. .... .Europeans first encountered Guanabara Bay on January 1, 1502 (hence Rio de Janeiro, "January River"), by a Portuguese expedition under explorer Gaspar de Lemos captain of a ship in Pedro Álvares Cabral's fleet, or under Gonçalo Coelho. Allegedly the Florentine explorer Amerigo Vespucci participated as observer at the invitation of King Manuel I in the same expedition. The region of Rio was inhabited by the Tupi, Puri, Botocudo and Maxakalí peoples.
.In 1555, one of the islands of Guanabara Bay, now called Villegagnon Island, was occupied by 500 French colonists under the French admiral Nicolas Durand de Villegaignon. Consequently, Villegagnon built Fort Coligny on the island when attempting to establish the France Antarctique colony.
The city of Rio de Janeiro proper was founded by the Portuguese on March 1, 1565 and was named São Sebastião do Rio de Janeiro, in honor of St. Sebastian, the saint who was the namesake and patron of the then Portuguese Monarch D. Sebastião. Rio de Janeiro was the name of Guanabara Bay. Until early in the 18th century, the city was threatened or invaded by several, mostly French, pirates and buccaneers, such as Jean-François Duclerc and René Duguay-Trouin.
In the late 17th century, still during the Sugar Era, the Bandeirantes found gold and diamonds in the neighboring captaincy of Minas Gerais, thus Rio de Janeiro became a much more practical port for exporting wealth (gold, precious stones, besides the sugar) than Salvador, Bahia, which is much farther to the northeast. And so in 1763, the colonial administration in Portuguese America was moved from Salvador to Rio de Janeiro. The city remained primarily a colonial capital until 1808, when the Portuguese royal family and most of the associated Lisbon nobles, fleeing from Napoleon's invasion of Portugal, moved to Rio de Janeiro. The kingdom's capital was transferred to the city, which, thus, became the only European capital outside of Europe. As there was no physical space or urban structure to accommodate hundreds of noblemen who arrived suddenly, many inhabitants were simply evicted from their homes. There was a large influx of African slaves to Rio de Janeiro: in 1819, there were 145,000 slaves in the captaincy. In 1840, the number of slaves reached 220,000 people.
When Prince Pedro I proclaimed the independence of Brazil in 1822, he decided to keep Rio de Janeiro as the capital of his new empire. Rio continued as the capital of Brazil after 1889, when the monarchy was replaced by a republic. Until the early years of the 20th century, the city was largely limited to the neighborhood now known as the historic Downtown business district (see below), on the mouth of Guanabara Bay. The city's center of gravity began to shift south and west to the so-called Zona Sul (South Zone) in the early part of the 20th century, when the first tunnel was built under the mountains located between Botafogo and the neighborhood now known as Copacabana. Expansion of the city to the north and south was facilitated by the consolidation and electrification of Rio's streetcar transit system after 1905. Botafogo's natural beauty, combined with the fame of the Copacabana Palace Hotel, the luxury hotel of the Americas in the 1930s, helped Rio to gain the reputation it still holds today as a beach party town (though, this reputation has been somewhat tarnished in recent years by favela violence resulting from the narcotics trade). Plans for moving the nation's capital city to the territorial centre had been occasionally discussed, and when Juscelino Kubitschek was elected president in 1955, it was partially on the strength of promises to build a new capital. Though many thought that it was just campaign rhetoric, Kubitschek managed to have Brasília built, at great cost, by 1960. On April 21 that year the capital of Brazil was officially moved from Rio de Janeiro to Brasília.
Between 1960 and 1975 Rio was a city-state under the name State of Guanabara (after the bay it borders). However, for administrative and political reasons, a presidential decree known as "The Fusion" removed the city's federative status and merged it with the State of Rio de Janeiro, the territory surrounding the city whose capital was Niterói, in 1975. Even today, some Cariocas advocate the return of municipal autonomy.
The city hosted the 2007 Pan American Games and will host the 2014 FIFA World Cup final. It was announced on October 2, 2009, that Rio would host the 2016 Olympic Games, beating the finalist competitors Chicago, Tokyo, and Madrid. The city will become the first South American city to host the event and the second Latin American city (after Mexico City in 1968) to host the Games.