With the advancement of technology and the rise of the unmanned aerial vehicle industry, the use of drones has grown tremendously. For drones performing near-ground delivery missions, the problem of 3D space-based path planning is particularly important in the autonomous navigation of drones in complex spaces. Therefore, an improved butterfly optimization (BOA-TSAR) algorithm is proposed in this paper to achieve the autonomous pathfinding of drones in 3D space. First, this paper improves the randomness strategy of the initial population generation in the butterfly optimization algorithm (BOA) via the Tent chaotic mapping method, by means of the removal of the short-period property, which balances the equilibrium of the initial solutions generated by the BOA algorithm in the solution space. Secondly, this paper improves the shortcomings of the BOA algorithm in terms of slower convergence, lower accuracy, and the existence of local optimal stagnation when dealing with high-dimensional complex functions via adaptive nonlinear inertia weights, a simulated annealing strategy, and stochasticity mutation with global adaptive features. Finally, this paper proposes an initial population generation strategy, based on the 3D line of sight (LOS) detection method, to further reduce the generation of path interruption points while ensuring the diversity of feasible solutions generated by the BOA algorithm for paths. In this paper, we verify the superior performance of BOA-TSAR by means of simulation experiments. The simulation results show that BOA-TSAR is very competitive among swarm intelligence (SI) algorithms of the same type. At the same time, the BOA-TSAR algorithm achieves the optimal path length measure and smoothness measure in the path-planning experiment.