C. elegans are either male or hermaphrodites, but why aren't there any females?
The evolution of self-fertile hermaphrodites is thought to be a specialization that occurred several times in the nematoda. For example, most of small, free-living soil nematode species related to C. elegans are male/female. C. briggsae, which last shared a common ancestor 80 myr ago is also male/hermaphrodite, but I believe their ancestor is thought to have been male/female. 
At the developmental level, the first germ cells to mature in the somatic gonad develop as sperm and then the Germline switches over to make oocytes.