Motile cilia are slender, hair-like cellular appendages that spontaneously oscillate under the action of internal molecular motors and are typically found in dense arrays. These active filaments coordinate their beating to generate metachronal waves that drive long-range fluid transport and locomotion. Until now, our understanding of their collective behavior largely comes from the study of minimal models that coarse grain the relevant biophysics and the hydrodynamics of slender structures. Here we build on a detailed biophysical model to elucidate the emergence of metachronal waves on millimeter scales from nanometer-scale motor activity inside individual cilia. Our study of a one-dimensional lattice of cilia in the presence of hydrodynamic and steric interactions reveals how metachronal waves are formed and maintained. We find that, in homogeneous beds of cilia, these interactions lead to multiple attracting states, all of which are characterized by an integer charge that is conserved. This even allows us to design initial conditions that lead to predictable emergent states. Finally, and very importantly, we show that, in nonuniform ciliary tissues, boundaries and inhomogeneities provide a robust route to metachronal waves.