There are multiple cases.
1) Child seiyuu (voice actors) are pretty much unheard of in Japan. (It is not impossible [for example, Matsuura Aya voiced Kaga Rin in Usagi Drop, which aired when she was about 10 years old], but most seiyuu are at least 14 years old when they begin working [such as Maaya Sakamoto when she debuted as Kanzaki Hitomi in Tenkuu no Escaflowne, a character of her own age]). It is common to debut through audition or to complete a degree in an Anime Manga Seiyuu senmongakkou (technical college). Finding a young boy to voice boy roles is uncommon. It is worth noting that very young girl roles are likewise usually played by adult women, not by young girls (for example, the younger sister Mei in Tonari no Totoro). When casting young girls or boys in Japanese theatrical stage productions, usually 2 to 4 children must be cast for a single role, because child labor laws do not allow a child to work more than a certain number of hours per week (for example, Chibiusa and Chibichibi in the Sailor Moon musicals a.k.a. SeraMyu and Rudolf in Elisabeth); this is also partly why it is common to cast adult women as young girls and boys even in Japanese live-action stage plays).
2) Many characters in anime, such as protagonists of extremely long-running children's series, are boys who have not yet hit puberty, which is when their voices would change (for example, Satoshi in Pokemon and Conan in Meitantei Conan). Employing a female seiyuu allows the character a high-pitched, youthful, cute sound, and the series can go on for decades without any need to replace the voice (whereas if a young male had been cast, his voice might break and become too low for the character).
3) Bishounen (pretty-boy) characters are often, though not always, voiced by women. In some cases, the fact that the character is male is not revealed until a number of episodes after the character is introduced, which creates gender-bending hijinks for the other characters who aren't yet in the know.
4) Characters whose sex and/or gender is intended to remain ambiguous are often given female seiyuu (for example, Frol in 11 Nin Iru! and Alluka in HUNTER x HUNTER). Characters who switch sexes are often given female seiyuu, which allows the same seiyuu to voice the character at all times (for example, the Sailor Starlights in Sailor Moon or Dilandau in Tenkuu no Escaflowne). In contrast, in dubs of Sailor Moon in other languages, 2 voice actors were cast for each of the Starlights, 1 to voice the female scenes and another to voice the male scenes. The benefit of the Japanese style is to employ a single seiyuu who can play the entire role as well as perform the songs for CD character image songs.
5) As compared to voice actors in other countries, seiyuu have a very high level of skill and training, and it is a lucrative career. This valid career option allows seiyuu who become famous and beloved by their fans to continue to work for decades (they need not worry about signs of aging as much as live-action film actors do). Other than those with very low masculine voices, their own age in real-life is irrelevant regarding what age of character they can play (this is a reason that child seiyuu are not necessary). Seiyuu can acquire large fan bases, and production companies will hire them partly based on the star power of having their name in the cast (in other words, some viewers will watch an anime simply due to the fact that a certain favorite seiyuu is in the series). Some seiyuu have a wide range of character roles they can play, others are "typecast" --- but in a way that fans know what to expect out of them and it is generally viewed as a positive feature rather than a limitation. As a result, certain female seiyuu are more likely than others to be employed in roles of young boys or bishounen, because they are renowned for such work and/or it's what the fans want to hear.
It is worth noting that sometimes Japan does the unexpected in terms of voice casting. The female mother wolf character of Moro in Mononoke-hime is voiced by Miwa Akihiro, a male seiyuu who is a drag queen with a low, deep voice.