The origin of octupole deformation for even-even nuclei near the doubly-closed shell configurations are investigated by means of the semiclassical periodic orbit theory. In order to focus on the change of shell structure due to deformation, a simple infinite-well potential model is employed with octupole shape parametrized by merging a sphere and a paraboloid. Attention is paid to the contributions of the degenerate families of periodic orbits (POs) confined in the spherical portion of the potential, that are expected to partially preserve the spherical shell effect up to considerably large value of the octupole parameter. The contribution of those POs to the semiclassical trace formula plays an important role in bringing about shell energy gain due to octupole deformation in the system with a few particles added to spherical closed-shell configurations.