We have performed a three-dimensional magnetohydrodynamic simulation to study the emergence of a twisted magnetic flux tube from −20 000 km of the solar convection zone to the corona through the photosphere and the chromosphere. The middle part of the initial tube is endowed with a density deficit to instigate a buoyant emergence. As the tube approaches the surface, it extends horizontally and makes a flat magnetic structure due to the photosphere ahead of the tube. Further emergence to the corona breaks out via the interchange-mode instability of the photospheric fields, and eventually several magnetic domes build up above the surface. What is new in this three-dimensional experiment is multiple separation events of the vertical magnetic elements are observed in the photospheric magnetogram, and they reflect the interchange instability. Separated elements are found to gather at the edges of the active region. These gathered elements then show shearing motions. These characteristics are highly reminiscent of active region observations. On the basis of the simulation results above, we propose a theoretical picture of the flux emergence and the formation of an active region that explains the observational features, such as multiple separations of faculae and the shearing motion.