The first residents of present-day Brazil were the Arawak and Carib Indians, to the north, the Tupí-Guarani, on the east coast and the Amazon basin, the Ge, settled in the eastern and southern regions of the country, and the Pano, to the west. Most of these tribes were semi-nomadic and lived by hunting, gathering, and primary agriculture.
The first European to arrive in Brazil was the Spaniard Vicente Yáñez Pinzón, he made landfall near the site of present-day Recife, on January 26, 1500 and arrived in the current region of Cabo de San Agustín (Pernambuco) that same day.
In April of 1500, the Portuguese navigator Pedro Alvarez Cabral also reached the Brazilian coast. He officially proclaimed the region possession of Portugal. The territory was called Terra da Vera Cruz (in Portuguese, “Land of the True Cross”). In 1501, the Italian navigator Américo Vespucio led an expedition over this new territory at the instigation of the Portuguese government. In the course of these explorations, Vespucci recognized and named many capes and bays, including that of Rio de Janeiro. He returned to Portugal with brasilete (Pernambuco wood that provided a red dye). The Land of Vera Cruz took, as of this date, the name of Brazil.
The occupation of the territory began in 1532 with the founding of the town of São Vicente by Martim Afonso de Sousa. In 1549 the first capital of Brazil was founded, the city of Salvador, in the province of Bahia. During the 16th century, slavery was tried, initially by indigenous people and only in the last decades were African captives introduced. In 1555, the French tried to settle by establishing a colony on the banks of the Bay of Rio de Janeiro. In 1560, the Portuguese destroyed this colony and created, in 1567, the city of Rio de Janeiro. In 1580, Philip II, King of Spain, inherited the crown of Portugal. This period of union of the two kingdoms, until 1640, was marked by frequent English and Dutch aggressions against Brazil.
In the seventeenth century, slave-based agriculture, with plantations of cassava, tobacco and especially sugar cane, obtained a great development. These activities were developed in the Northeast of the colony, from the Bahian and Pernambuco nuclei and, later, Rio de Janeiro. The northern colonies were occupied by the Dutch in 1624 and between 1630 and 1654. Portugal, after establishing a series of captaincies general on the coasts, raised its possessions to the rank of principality when the heirs to the Portuguese throne were declared princes of Brazil in 1634. In 1624, a Dutch fleet seized Bahia. But the following year, the city was retaken by an army made up of Spanish, Portuguese, and Indians.
In 1808, the Portuguese royal family – and with them the Portuguese nobility – escaped the troops of the French emperor, Napoleon Bonaparte, who was invading Portugal and most of Central Europe, and settled in the city of Rio de Janeiro, which in this way became the de facto capital of the Portuguese Empire. In 1815, John VI, then the Prince Regent of Portugal on behalf of his mother Maria I, elevated the State of Brazil to a sovereign Kingdom in union with Portugal. In 1809, the Portuguese invaded French Guiana, which was finally returned to France in 1817. In the year 1825, the United Provinces of the Río de la Plata started a war to recover the Eastern Band, occupied by the Portuguese in 1816 and renamed the Cisplatina province, which was concluded in 1828 by means of an agreement in which the independence of the province was provided. 
Independence and empire
The 26 of April of 1821 Juan IV returns to Portugal, leaving his son Pedro de Alcantara, as Prince Regent. The Portuguese government tried to transform Brazil into a colony again, depriving it of the rights it had had since 1808. The Brazilians refused to give in, and the prince regent joined their cause, declaring the country’s independence on September 7, 1822. On October 12, Pedro was declared the first emperor of Brazil and crowned Pedro I on December 1.
Although the first attempts to free the country from Portuguese control adopted republican ideals —as was the case with the Mining Conspiracy, led by Tiradentes—,  in the 19th century almost all Brazilians were in favor of the monarchy and republicanism. had little support. The Brazilian War of Independence spread throughout almost the entire territory, while the main battles were fought in the north, northeast, and south regions. The last Portuguese soldiers surrendered on 8 of March of 1824, and independence was recognized by Portugal on 29 of August 1825, in the Treaty of Rio de Janeiro.
On March 25, 1824, the first constitution was promulgated after its approval by all the municipal councils of the country.  On April 7, 1831, Pedro I abdicated when he returned to Europe to regain the throne of his family, leaving his five-year-old son, Pedro II, as his successor. As the new emperor could not exercise his functions, a regency was created. Disputes between different political factions led to rebellions and an unstable and almost anarchic regency.  However, the rebel groups were not against the monarchy, although some declared the secession of their provinces as independent republics. The most notorious case was that of Rio Grande do Sul and Santa Catarina, who through the War of the Farrapos proclaimed themselves independent from the Brazilian Empire.  After these secessionist incidents and as a result of them Pedro II was prematurely declared emperor, for almost half a century Brazil experienced a time of economic flourishing and internal peace.
According to Youremailverifier, the reign of Pedro II led Brazil to victory in three international wars – the Great War, the War against Aguirre and the War of the Triple Alliance -, in addition to witnessing the consolidation of representative democracy, mainly due to the realization of successive elections and freedom of the press. Slavery died out in a slower but steady process, which began in 1850 with the end of the international slave trade, and ended with the total abolition of slavery in 1888. When the Empire was overthrown on November 15, 1889, there was little interest on the part of the Brazilian people to change the form of government from a monarchy to a republic,  since Pedro II was at the peak of his popularity among the population. The republican military coup was supported by the former slave owners who refused to accept the abolition of slavery agreed in 1888 by the monarchical government.