Context. Spatial correlations between spiral arms and other galactic components such as giant molecular clouds and massive OB stars suggest that spiral arms can play vital roles in various aspects of disk galaxy evolution. Segmentation of spiral arms in disk galaxies is therefore a key task when these correlations are to be investigated. Aims. We therefore decomposed disk galaxies into spiral and nonspiral regions using the code U-Net, which is based on deep-learning algorithms and has been invented for segmentation tasks in biology. Methods. We first trained this U-Net with a large number of synthesized images of disk galaxies with known properties of symmetric spiral arms with radially constant pitch angles and then tested it with entirely unknown data sets. The synthesized images were generated from mathematical models of disk galaxies with various properties of spiral arms, bars, and rings in these supervised-learning tasks. We also applied the trained U-Net to spiral galaxy images synthesized from the results of long-term hydrodynamical simulations of disk galaxies with nonsymmetric spiral arms. Results. We find that U-Net can predict the precise locations of spiral arms with an average prediction accuracy (Fm) of 98%. We also find that Fm does not depend strongly on the numbers of spiral arms, presence or absence of stellar bars and rings, and bulge-to-disk ratios in disk galaxies. These results imply that U-Net is a very useful tool for identifying the locations of spirals arms. However, we find that the U-Net trained on these symmetric spiral arm images cannot predict entirly unknown data sets with the same accuracy that were produced from the results of hydrodynamical simulations of disk galaxies with nonsymmetric irregular spirals and their nonconstant pitch angles across disks. In particular, weak spiral arms in barred-disk galaxies are properly segmented. Conclusions. These results suggest that U-Net can segment more symmetric spiral arms with constant pitch angles in disk galaxies. However, we need to train U-Net with a larger number of more realistic galaxy images with noise, nonsymmetric spirals, and different pitch angles between different arms in order to apply it to real spiral galaxies. It would be a challenge to make a large number of training data sets for such realistic nonsymmetric and irregular spiral arms with nonconstant pitch angles.