The origin and structural and functional significance of modular design in organisms represent an important issue debated in many different disciplines. To be eventually successful in clarifying the evolutionary mechanisms underpinnrng the emergence of modular design in complex organisms, one should be able to cover all different levels of biological hierarchy. Specifically, one should be able to investigate modularity at the behavioral level - the level on which natural selection operates - and understand how this level is related to the genetic level — the level at which natural selection works through mutation and recombination. We describe a simulation of the evolution of a population of robots that must execute a complex behavioral task to reproduce. During evolution modular neural networks, which control the robots' behavior, emerge as a result of genetic duplications. Simulation results show that the stepwise addition of structural units, in this case genetic and neural ‘modules’, can lead to a matching between specific behaviors and their structural representation, i.e., to functional modularity.