The familiar, white Cattle Egret originally comes from the "old world", primarily what's known as west Africa. Back in the 19th century, there was a lot of ship traffic across the Atlantic, and there have always been strong winds. Somehow, some Cattle Egrets reached northeastern South America in the late 1800s - present day northern Brazil. (exactly HOW they crossed the ocean will always be a mystery)
They like to hang around grazing animals, and Brazil had plenty. Very gradually, the Egrets expanded their range northward, always associating with large grazing animals.