A molecular field theory and coarse-grained computer simulations with dissipative particle dynamics have been used to study the spontaneous orientational ordering of anisotropic nanoparticles in the lamellar and hexagonal phases of diblock copolymers and the effect of nanoparticles on the phase behavior of these systems. Both the molecular theory and computer simulations indicate that strongly anisotropic nanoparticles are ordered orientationally mainly in the boundary region between the domains and the nematic order parameter possesses opposite signs in adjacent domains. The orientational order is induced by the boundary and by the interaction between nanoparticles and the monomer units in different domains. In simulations, sufficiently long and strongly selective nanoparticles are ordered also inside the domains. The nematic order parameter and local concentration profiles of nanoparticles have been calculated numerically using the model of a nanoparticle with two interaction centers and also determined using the results of computer simulations. A number of phase diagrams have been obtained which illustrate the effect of nanoparticle selectivity and molar fraction of the stability ranges of various phases. Different morphologies have been identified by analyzing the static structure factor and a phase diagram has been constructed in coordinates' nanoparticle concentration-copolymer composition. Orientational ordering of even a small fraction of nanoparticles may result in a significant increase of the dielectric anisotropy of a polymer nanocomposite, which is important for various applications.