colony and territory in country terms mean the same thing
the independence was in 1822
the portuguese court was moved to Brazil in 1808
https://en.wikipedia.org/wiki/Transfer_of_the_Portuguese_court_to_Brazil
So between 1808 and 1820 Brazil was center of the empire and Portugal just a territory
now stfu you clearly don't know nothing about Brazil's history
how about read your own article it literally just said that when it was moved to Brazil it was still a COLONY meaning that it was still the Portuguese empire it was just moved to Brazil because of a invasion and after most of the court went back home to Portugal and then the king gave Brazil independence and became king of the Brazilian empire while the Portuguese got a queen to replace him