Sex disorders are usually a cause of hypogonadism occurring before puberty. This could be due to damage of the central nervous system (thalamus - pituitary gland ie: due to tumor), the gonads etc. It could be part of the manifestations of a syndrome such as Klinefelter's syndrome (a chromosomal anomaly with chromosome count 47, XXY sex chromosome constitution; buccal and other cells are usually sex chromatin positive; patients are male in development but have seminiferous tubule dysgenesis, elevated plasma and urinary gonadotropins, variable gynecomastia, and eunuchoid habitus).
Generally speaking, when a male has a problem and produces no androgens for some reason, he will result in having primary or just secondary female characteristics, cause androgens are needed for the sex differentiation of the male. This could also be a result not of lack of androgens but lack of androgen function - androgens could be present but can not act due to a disorder of the corresponding receptors in the perifery. Then all the overproduced androgens are aromatized to estrogens in fat tissue which also results in sex disorder.
Same goes for the females. No estrogen - no sex differentiation. And since the path of sex differentiation is common between males and females up to a certain level, they result getting undevelloped sex organs that do resemble male genitalia.