The mechanism of entrainment to natural oscillations in a class of (bio) mechanical systems described by linear models is investigated. A nonlinear control strategy (based on the speed gradient control algorithm) is analyzed providing the system oscillation in resonance mode with a natural frequency. It ensures an energy-optimal entrainment performance robustly against perturbations in system parameters in a finite time. The obtained controller equations can be interpreted as equations of a dynamical neural network. Assuming that the resetting mechanism in animals is selected to ensure a suboptimal entrainment performance, the neural network interpretation may be helpful for understanding the entrainment phenomenon in nature. Efficiency of the proposed entrainment solutions is demonstrated by examples of computer simulation.