What is the history behind the languages spoken in Brazil; what did they speak before they spoke Portuguese and why do they not speak "Brazilian"?
Edit: *Portuguese.
Brazil is a gigantic country, nearly as large as the United States. Before colonization, there was no single language--or even group of languages--widely spoken throughout modern Brazil. With a very diverse range of climates and terrain, there were numerous geographical, sociological, and technological barriers which prevented single languages from traveling across the entire region.
The Gê language family was spread across much of Brazil before European colonization, especially in the Cerrado and subtropical forests of southern and central Brazil. While all Gê languages have noticable similarities, an Apinaye speaker from today's Tocantins State would not be able to easily communicate with a Kaingang speaker of today's Santa Catarina.
Other prominent language families of ancient Brazil include the Tupian languages, especially common along the Eastern coast of Brazil, the grasslands of Rio Grande do Sul, and deep in the Amazon rainforest. Arawakan, Cariban, and several other smaller language families, also had some presence in Brazili, especially the Amazon. In total, there were at a minimum a few dozen languages spoken in Brazil before colonization, and most likely several hundred.
Following the Treaty of Tordesillas in 1494, Portugal was given legal right by the Pope to colonize lands east of a line "370 leagues west of Cape Verde." This excluded Portugal from settling the newly discovered Carribean, but gave them legal authority in the eyes of the Catholic Church to settle South American land discovered east of the line in 1500.
Brazilwood, a tree common along the coast, could be ground into powder for use as red dye. It rapidly became a popular export, and spurred Portugese colonization of Brazil. The climate of Brazil was also excellent for growing sugarcane, and a growing slavery-fueled sugar industry further stimulated the settlement of Brazil. The Portuguese government sponsored Portuguese nobles in establishing estates in the new colony, promoting the creation of an almost entirely Portuguese-speaking colonial population.
Portuguese adventureres, including explorers, traders, settlers, and raiders, went far beyond the boundaries of the Treaty of Tordesillas, into land which was claimed (but not actually settled) by the Spanish. Following an intensification of disputes over the matter in the early 1700s, the 1750 Treaty of Madrid established a new dividing line between the Portuguese colony of Brazil and the Spanish colonies of New Grenada and Peru. While there was some Portuguese settlement of Spanish colonies, the extent of this was not nearly enough for the Portuguese language to become widespread outside of Brazil.
Brazil gained independence from Portugal in 1822, but being predominantly settled by the Portuguese in colonial times, that remained its most common language. While large numbers of Africans were brought as slaves, no single African language was ever widespread across Brazil, and the descendants of African slaves almost exclusively speak Portuguese.
The spread of diseases from European settlers, coupled with enslavement and killings by the colonists, led to drastic decline in indigenous populations across Brazil. The coasts, once dominated by speakers of Tupian languages, were the first to become almost exclusively Portuguese speaking. Inland expansion over the subsequent centuries meant further declines in indigenous languages, and further domination of the Portuguese language--this continues even today in remote areas of the Amazon. As such, the fate of Brazil's pre-Portuguese languages has primarily been extinction. Those indigenous languages that survive are greatly reduced in number, are not widely used in daily life, and most continue to decline.
Immigration to Brazil increased in the late 19th century, peaking around the turn of the century. While large communities of German, Italian, Spanish, and Japanese speakers moved to Brazil, nearly all immigrants assimilated into the Portuguese-speaking society of Brazil. While the German speaking community in particular remains active throughout Brazil, the vast majority of Brazilian German speakers also speak Portuguese.