Sociability, an animal's ease and propensity to interact with members of its own species, is a prerequisite for many important social interactions including courtship, mating, brood rearing, and collective behavior. Despite its fundamental nature, the manner through which sociability arises -whether it is innate or acquired and its neural mechanisms- remains unknown. Here, we found that the fly, Drosophila melanogaster, produces a constellation of fearful reactions when it encounters another fly for the first time. However, these animals become sociable following several hours of exposure to conspecific (but not heterospecific) odors. Two large-scale neural silencing screens of 188 brain cell types revealed that both initial fearful reactions and learned sociability depend upon overlapping networks including circuits in the mushroom body, the principal center for associative learning and memory in the insect brain. Functional recordings of key mushroom body output neurons (MBONs) from this network over two hours of social interactions support a mechanistic model whereby fly odors modulate social valence by rebalancing MBON population activity, biasing action selection, and thereby driving sociable rather than fearful responses towards other flies. Thus, a center for learning and memory plays a fundamental role in establishing the basis for most social interactions.