How evolutionary changes in genes and neurons encode species variation in complex motor behaviors are largely unknown. Here, we develop genetic tools that permit a neural circuit comparison between the model speciesDrosophila melanogasterand the closely-related speciesD. yakuba, who has undergone a lineage-specific loss of sine song, one of the two major types of male courtship song inDrosophila. Neuroanatomical comparison of song patterning neurons called TN1 across the phylogeny demonstrates a link between the loss of sine song and a reduction both in the number of TN1 neurons and the neurites serving the sine circuit connectivity. Optogenetic activation confirms that TN1 neurons inD. yakubahave lost the ability to drive sine song, while maintaining the ability to drive the singing wing posture. Single-cell transcriptomic comparison shows thatD. yakubaspecifically lacks a cell type corresponding to TN1A neurons, the TN1 subtype that is essential for sine song. Genetic and developmental manipulation reveals a functional divergence of the sex determination genedoublesexinD. yakubato reduce TN1 number by promoting apoptosis. Our work illustrates the contribution of motor patterning circuits and cell type changes in behavioral evolution, and uncovers the evolutionary lability of sex determination genes to reconfigure the cellular makeup of neural circuits.