X-ray diffraction measurements with the use of both laboratory and synchrotron X-ray sources and transmission electron microscopy have been applied to study two types of GaN nanowires grown by plasma assisted molecular beam epitaxy on Si (001) substrates. Detailed structural analysis of the first type of nanowires reveals wurtzite type of GaN grown with the c-axis perpendicular to the substrate surface and with good in-plane correlation with the substrate. A thin silicon nitride film is found between these nanowires and Si (001). Second group contains GaN nanowires of a novel type that are aligned perpendicular to the Si (111) planes, so are inclined to the Si (001) substrate surface. They grow without any interlayer in a direct contact with the substrate, first as rooflet-like zb-GaN islands and then transform to more stable wurtzite phase by the growth of pure hexagonal wz-GaN nanowires. Our findings show a crucial role of silicon nitride interlayer for growth mode and crystallographic alignment of GaN nanowires on silicon substrate.