Abstract Animal behavior emerges from a seamless interaction between neural network dynamics, musculoskeletal properties, and the physical environment. Accessing and understanding the interplay between these intertwined elements requires the development of integrative and morphologically realistic neuromechanical simulations. Until now, there has been no such simulation framework for the widely studied model organism, Drosophila melanogaster . Here we present NeuroMech-Fly, a data-driven model of the adult female fly within a physics-based simulation environment. NeuroMechFly combines a series of independent computational modules including a biomechanical exoskeleton with articulating body parts−legs, halteres, wings, abdominal segments, head, proboscis, and antennae−muscle models, and neural network controllers. To enable illustrative use cases, we first define minimal leg degrees-of-freedom by analyzing real 3D kinematic measurements during real Drosophila walking and grooming. Then, we show how, by replaying these behaviors using NeuroMechFly’s biomechanical exoskeleton in its physics-based simulation environment, one can predict otherwise unmeasured torques and contact reaction forces. Finally, we leverage NeuroMechFly’s full neuromechanical capacity to discover neural networks and muscle parameters that enable locomotor gaits optimized for speed and stability. Thus, NeuroMechFly represents a powerful testbed for building an understanding of how behaviors emerge from interactions between complex neuromechanical systems and their physical surroundings.