It actually was first made in 1945 because of an election. The main candidates were general Eurico Gaspar Dutra (minister of war in Getulio Vargas' government) and brigadier Eduardo Gomes (a military who worked in the Brazilian aeronautics). Gomes used a very unusual slogan, "vote no brigadeiro, que é bonito e solteiro" [in a literal translation: vote for the brigadier, who is handsome and single], with which - curiously - he whon the heart of many girls. Those girls, in turn, prepared a special candy at home to raise funds for the brigadier's campaign, claiming it was "the brigadier's favourite dessert". After a while, the candy, made with sweetened condensed milk, butter and chocolate powder, came to be known as "brigadeiro".
Oh, and Gomes didn't win the presidential election. Great consolation prize, though!