The flow of interstellar gas in the gravitational field of a galactic spiral density wave was calculated at the galactocentric distance 5 kpc, including the thermal processes in medium. It was shown that if the initial gas density n0 less-than-or-similar-to 0,05 cm-3, the influence of arms is reduced to a galactic shock only. If 0,05 cm-3 less-than-or-similar-to n0 less-than-or-similar-to 0,2 cm-3, the phase transition occurs in the medium with formation of inhomogeneities stretched along arms-filaments which break down into clouds subsequently. Some observed data about HI clouds are accounted for in the framework of the developed theory. If n0 greater-than-or-similar-to greater-than-or-similar-to 0,5 cm-3, then the powerful nonlinear wave - accretion wave - arises in gas under the influence of the spiral density wave. Some arguments are given in favour for atomic hydrogen being remade into the molecular one in the accretion wave. An explanation of the <<sandwich>> structure of Galactic disk is also given.