According to TVTropes,
Sometimes, an animated character is better suited for being voiced by
a voice actor of the opposite sex. Maybe a higher voice is needed for
a male, or a lower voice for a female.
A common variant for this is for young boys, usually 12 and under, to
be voiced by an adult woman. This is because real little boys' voices
deepen when they go through puberty. Not to mention that it's easier
to find experienced actresses than experienced prepubescent male
actors. The producers don't have to deal with child labor laws that
limit the amount of time a child can spend in a studio, either. Women
are often able to maintain the role longer, as well, since their
voices don't change like a growing boy's.
There are exceptions, of course — sometimes an adult man or an actual
child will voice a little boy. In films, this is the rule rather than
the exception, as voice recording for a film generally takes much less
time than for a TV series.
And on a related note, sometimes, for comedy purposes, a deep-voiced
woman will be played by a man.
Also, female seiyuu voice acting as a male character is much more common than male seiyuu voice acting as a female character probably because it is easier for a woman to lower her voice's pitch than a man to make his voice's pitch higher like that of a woman.
Personally, I don't know of any male seiyuu who voice acted a female character, but Jun Fukuyama voiced Grell Sutcliff who acted as gay.
From the TVTropes link I have provided, here are some examples (some examples are from Japanese animated films or games):
- Spy D is voiced by Tessho Genda, who is a well-known Japanese live-action actor renowned for his "tough guy" roles. In fact, Spy D's personality and physical appearance were based on Tessho Genda. It is reported that he had no idea the character was female until he saw the finished movie.
- Akihiro Miwa, a male actor and cabaret singer, has played female roles in two Miyazaki films: The Witch of the Waste in Howl's Moving Castle and Moro in Princess Mononoke, who is a giant wolf for which a deep growling voice is actually quite appropriate.
- A rather interesting (and literal) twist in Gundam 00: In one of the drama CDs, Tieria poses as a female student to infiltrate the high school that Louise and Saji attend. While disguised, his voice is provided by...his normal voice actor, Hiroshi Kamiya, who can apparently pull off a rather convincing female voice. Who knew?
- This is repeated in the second season, where Tieria dresses as a woman (with Gag Boobs, hence the Fan Nickname "Titeria") to infiltrate a party the bad guys are throwing. Considering Tieira was a major source of Viewer Gender Confusion before the show aired...
- In ICE, Julia is played by a man in both Japanese and English.
- In Ixion Saga DT, Jun Fukuyama voices Mariandale, the princesses' maid. Turns out he's just cross dressing.