Biological networks have an inherent simplicity: they are modular with a design that can be separated into units that perform almost independently. Furthermore, they show reuse of recurring patterns termed network motifs. Little is known about the evolutionary origin of these properties. Current models of biological evolution typically produce networks that are highly nonmodular and lack understandable motifs. Here, we suggest a possible explanation for the origin of modularity and network motifs in biology. We use standard evolutionary algorithms to evolve networks. A key feature in this study is evolution under an environment (evolutionary goal) that changes in a modular fashion. That is, we repeatedly switch between several goals, each made of a different combination of subgoals. We find that such ''modularly varying goals'' lead to the spontaneous evolution of modular network structure and network motifs. The resulting networks rapidly evolve to satisfy each of the different goals. Such switching between related goals may represent biological evolution in a changing environment that requires different combinations of a set of basic biological functions. The present study may shed light on the evolutionary forces that promote structural simplicity in biological networks and offers ways to improve the evolutionary design of engineered systems. B iological and engineered systems share general design features: they display modularity, defined as the separability of the design into units that perform independently, at least to a first approximation (1-3, 5). † Furthermore, they show reuse of certain circuit patterns, termed network motifs (6-11), in many different parts of the system. These features allow construction of extremely complex systems by using simple building blocks (12).These features of biological networks are not captured by most current models of biological evolution. For example, many models of biological evolution use computers to evolve networks to attain a defined goal. In these simulations, networks in a population are varied by means of mutations, crossover, and duplication (13-15). Networks that perform better are selected in the next generation. A well known feature of these computational models of biological evolution is that the evolved systems are usually intricately wired and nonmodular. The nonmodular solutions are often more highly optimized than their human-engineered counterparts (16,17,20).The fundamental reason for the lack of modularity in these evolved networks is that modular structures are usually less optimal than nonmodular ones. Typically, there are many possible connections that break modularity and increase fitness. Thus, even an initially modular solution rapidly evolves into one of many possible nonmodular solutions.Lack of modularity is one of the reasons that computational evolution can currently generate designs for simple tasks, but has difficulty in scaling up to higher complexity. In the field of evolutionary design of engineered systems, approaches have been dev...