A detailed qualitative analysis and numerical modeling of the evolution of cosmological models based on nonlinear classical and phantom scalar fields with self-action are performed. Complete phase portraits of the corresponding dynamical systems and their projections onto the Poincaré sphere are constructed. It is shown that the phase trajectories of the corresponding dynamical systems can, depending on the parameters of the model of the scalar field, split into bifurcation trajectories along 2, 4, or 6 different dynamic streams. In the phase space of such systems, regions can appear which are inaccessible for motion. Here phase trajectories of the phantom scalar field wind onto one of the symmetric foci (centers) while the phase trajectories of the classical scalar field can have a limit cycle determined by the zero effective energy corresponding to a Euclidean Universe.