Ultrathin films of manganese silicides on silicon are of relevance as a possible material system for building spintronics devices with silicon technology. In order to achieve insight into epitaxial growth of such films on Si(001), total-energy calculations are presented using density-functional theory and the full-potential augmented plane wave plus local orbital method. For adsorption of a single Mn atom on Si(001), we find that binding at the subsurface sites below the Si surface dimers is ~0.9 eV stronger than on-surface adsorption. There is an energy barrier of only 0.3 eV for adsorbed Mn to go subsurface, and an energy barrier of 1.2 eV for the reverse process. From the calculated potential-energy surface for the Mn adatom, we conclude that the most stable site on the surface corresponds to the hollow site where Mn is placed between two Si surface dimers. For on-surface diffusion, both along and perpendicular to the Si dimer rows, the Mn atoms have to overcome energy barriers of 0.65 eV. For deposition of 0.5 monolayers (ML) or more, we find that the Si dimers of the Si(001) surface are broken up, and a mixed MnSi layer becomes the energetically most favorable structure. For coverages above 1 ML, the lowest-energy structure changes to a full Mn subsurface layer, capped by a layer of Si adatoms. We identify this transition with the onset of Mn-silicide formation in an epitaxially stabilized CsCl-like crystal structure. Such MnSi films are found to have sizable magnetic moments at the Mn atoms near the surface and interface, and ferromagnetic coupling of the Mn magnetic moments within the layers. Layer-resolved electronic densities of state are presented that show a high degree of spin polarization at the Fermi level, up to 45% and 27% for films with two or three Si-Mn layers, respectively.