The energetic, electronic and structural properties of a heterojunction formed by BN and AlN (10,0) nanotubes have been studied using first principles density functional theory. The differences between the AlN and BN nanotubes lead to structural rearrangements mainly at the junction layers. Two different types of junction occur, and net charges of opposite signs appear in each of them, with a resulting electric dipole along the heterojunction axis. The calculated band offset shows a staggered band line-up, with the heterojunction forming a one-dimensional array of quantum dots.