If you watch an anime dub in your language, you may not be getting the whole story. No, really - stay with us here. We're not dissing dubs (we do that here). We're saying, sometimes in the shift from Japan to wherever in the world you live, things get lost. Important things, like the bits between the characters' legs.
Yep, sometimes anime characters completely change genders in the transition from Japan to other regions. Why does this happen? Your gut instinct is correct - the MAN is trying to censor things!... at least partially. But censorship is not the only reason genders might get switched. From just general ineptitude, to language barriers, to a different kind of failure, there are a number of reasons why your favorite character got an unexpected sex change.
Reasons For Gender Switches in Anime Localization
Censorship
Let's get the obvious one out there right away. Yes, many gender changes in localization happen for the purposes of censorship. And yes, it happens for pretty much the reasons you'd expect.
Perhaps the most well-known example of this is Fisheye from Sailor Moon. In the Japanese version, Fisheye is an effeminate man who dresses like a woman and makes sexual advances on other men. This didn't fly with a number of countries, and he was subsequently changed into a woman so parents wouldn't have to talk about the scary LGBTQ community with their kids. Strangely enough, they didn't always bother covering "her" exposed chest. Won't somebody think of the children!?
Another example from Sailor Moon is Zoisite, who was changed into a woman by English localization teams as well as a couple of other countries. This was to hide his cross-dressing antics, as well as his relationship with the equally androgynous Kunzite.
We could make this entire list out of Sailor Moon characters, but there are, of course, other examples of gender censorship. In Japan, the villanous Lady Bat from Mermaid Melody Pichi Pichi Pitch Pure is a crossdressing man. In the Italian and Spanish dubs, though, he was turned into a woman, leading to all sorts of shenanigans that don't make sense in context. The anime has him flirting with a girl, something that was censored out of another lesbian couple in the anime. He also ends up dressing like a man for a bit anyway, turning him into a cross-dressing woman. Crisis averted!
Another notable censorship happens to Berg Katse from Gatchaman. Katse's entire backstory hinges on his ability to switch between genders at will. In the English dub, Battle of the Planets, this is explained away as Katse actually being two different characters, a brother and sister.
Confusion or Accident
But believe it or not, censorship is not the only reason anime characters change genders. Sometimes it's due to pure and simple failure on the part of the localization team to do their research. Whether the character is androgynous, or the team doesn't read through to the end of the anime before casting voice actors, lots of characters get gender switched by complete accident.
The Digimon series got a lot of this. Characters who went though sex changes due to a confused localization team include Iori Hida in Spain and Portugal, Renamon in Germany (lay off the cigs there, Sakuyamon..), Jun in the Philipenes, among others.
Aside from accidents, men pretending to be women (and vice versa) are sometimes so convincing that even the localization team is fooled. One character in Mai-HiME is revealed to be a cross-dresser in later episodes, but already had a distinctly gendered voice in the German dub.
Other times a localization team catches their mistake, and changes voice actors mid-season. It's great that the mistake is corrected, but causes all sorts of confusion when a character's voice randomly switches pitch as you're watching. Apparently the Brazillian dub did this for Goldva of Shaman King - the dub starts with a gravelly male voice, then switches to a female one in later episodes without any mention (to be fair, Goldva's voice is often pretty ambiguious). Saint Seiya has a few gender swaps of this kind too, with Shun apparently getting a female voice in the French dub, then switching to a more appropriate male voice. (We say "apparently" because we can't find any clips and are relying on anecdotal evidence here - if you have a clip of either of these, do share!).
Lack of Gender-Neutral Pronouns
In some languages, you can get away with referring to someone using non-gendered pronouns. In English, while the language doesn't make it easy, you can use "they" (this is also the preferred term when referring to genderqueer people). But not every language gives you that option. In languages like Spanish, Italian, and many others, there is no way to avoid giving a character genders. Any actions or descriptions will be gendered due to the very nature of these languages - you can say "it's beautiful," but you'd have to say "bello" or "bella" in Spanish, depending on the gender of the "it" being referenced.
Why are you getting this crash course on the gendering of terms in certain languages? Because anime loves androgynous and gender-less characters. The localization teams for these countries? Probably not so much. Every character needs to have a gender, which leads to some unexpected consequences.
In some shows that are meant to have ambiguously gendered characters, the dubs need to decide on a gender, or avoid using any descriptive terms about them. But in the end it's easier to just pick a gender and stick to it. This means a character like Crona is definitively turned into a male in many countries, including America. To be fair, the English translation just decided to say "he" because referring to Crona as an "it" would be awkward (and probably wouldn't do much for his already low self esteem).
Aside from removing the mystery of genders for androgynous characters, localizations often have to give genders to characters that you never even thought of as male or female. Is Pikachu male or female? This debate has since been relatively resolved (it's all in the tail), but even before this revelation, pokemon had localization teams using the pronoun "he" to refer to Pikachu. Other pokemon get this treatment too, sometimes missing the mark: Ash's Chikorita/Bayleaf is male in the Spanish dub (Bulbapedia says otherwise), Brock's Happiny is male in the Hindi dub (despite this being technically impossible), and… well, pretty much every pokemon is male unless proven otherwise.
Wider Audience Reach
And finally, we come full circle back to gender changes made on purpose. Some characters aren't changed by accident or to censor something deemed "unsavory." Instead, these characters are changed into a different gender to reach a wider audience in their localization.
This switch is most often used on male characters, who are turned into females to balance the gender ratio or to create a more appealing girl if the existing ones are moeblobs. For instance, although the reasons for this switch may have been different, one Latin American dub of Rayearth changed Eagle Vision into a girl - which inadvertantly turned "her" into a strong female character.
This is actually easier to see in a non-anime example: many of the original Japanese Yellow Rangers in the Power Rangers were male. Didn't you ever wonder why the yellow outfit didn't have a skirt like the pink one? No? Just us?