Considering the urgent need for efficient and safe river crossing strategies in natural disaster relief and outdoor sports, in-depth research on river crossing strategies based on mathematical modeling and optimization theory is of great significance for improving river crossing safety and efficiency and guiding practical operations in related fields. Aiming at the goal of "rushing across the Yangtze River", based on the variational method and functional analysis theory, the Hamilton-Lagrange multiplier method is used to solve the constrained functional extremum problem. By solving the Euler equation, a universal continuous-time optimal control model is established. Using dichotomy and numerical analysis, the optimal trajectory and direction control law of swimming speed is solved, and the optimal path scheme to reach the endpoint is proposed, which contributes to the efficiency and safety of river crossing and provides practical suggestions in related fields.