When: Brazil gained its independence on September 7th, 1822,
How: When Dom Pedro announced officially or publicly Brazil's independence after an showing an feeling active opposition or hostility toward Portugal-- proved too much for the Brazilian people.
Whom: It all began when Napoleon I invaded Portugal in 1807.