Whether an individual is male or female can be determined by a variety of different genetic systems. In humans and some insects such as Drosophila, females have 2 copies of an X chromosome and males have a single copy of the X chromosome and a Y chromosome. However, In the haplo-diploid system of many Hymenoptera, there are no X and Y chromosomes. The female Hymenoptera have 2 complete sets of chromosomes (diploid) while males have only a single set (haploid). In other insects, the females contain two X chromosomes and the males have only a single X chromosome, there are no Y chromosomes. Numerous other genetic systems occur in the insect world.
Gynandromorphs are animals that are half-male, half-female. Gynandromorphs are rare and typically sterile. A gynandromorph can be produced if early in the development of an embryo, an X chromosome fails to properly separate or if an X chromosome is lost. When this happens, those cells with two X chromosomes will have female characters and color patterns and those with a single X chromosome will have male characters and color patterns.
Gynandromorphy can produce jarring visual effects in insects that are sexually dimorphic (the males and females have differing coloration). For example, Tiger Swallowtail males are yellow with black stripes. The females are black and mimic the coloration of pipevine swallowtails. Livescience.com has a photo gallery of animal gynadromorphs including a Tiger Swallowtail gynandromorph collected by James K Adams of Dalton State Univeristy. The left half is phenotypically male and the right half, phenotypically female.