Brazil has a consumer law, that defines what companies can/can't do when selling to consumers. It has like, warranty minimums for durable goods (90 days), "no questions asked" return right for virtual purchases (7 days), etc... among those there is a very special one called "Venda Casada", which translates to tie-in/combined sale.
The "venda casada" article forbids the condition of an purchase to the necessity of purchasing another item (from whoever is selling it). For the Apple case, the judge understands that by removing the charger (and therefore selling as a separate product), Apple is forcing the consumer to purchase 2 items when acquiring an iPhone, as the charger is a must have item for a smartphone, and to make things worse, Apple has a proprietary charger so new customers and those migrating from other platforms (like android) will need to buy the charger.
The rationale is pretty similar to a TV brand selling a TV without the charging cable, since everyone has a TV, so they surely must already have a charging cable.
This is a law, it is not Brazil government/judiciary with some vendetta against Apple. Many companies have had decisions against them because of this.
I hope this helps make things clearer. Cheers!