The capacitated vehicle routing problem (CVRP) is regarded as an NP-hard problem. Moreover, the CVRP is described as a model that can be used in many applications such as transport, logistics, and distribution. The exact algorithms can find exact optimal solutions on the small-sized problem instances; however, for large-sized instances it is difficult to find the exact optimal solutions in polynomial time. This reason motivated the researchers to present heuristic/metaheuristic algorithms to solve large-sized problem instances within a reasonable computational time. One of the good algorithms that deal with the CVRP is the ant colony optimization (ACO) algorithm. Several ACO algorithms have been suggested in the literature, such as the ant system (AS) algorithm, ant colony system (ACS) algorithm, and so on. On the other hand, ACO is designed to solve the path problem that finds the best way. However, this algorithm still lacks exploratory mechanisms, which results in premature convergence and stagnation issues. Therefore, we propose to develop an enhanced ACS (EACS) algorithm for solving the CVRP based on subpaths. In our proposed algorithm, we propose to utilize the K-nearest neighbour (KNN) algorithm for finding the best initial solution and then enhance the diversity mechanism of the proposed algorithm by avoiding the generation of the same solution using subpaths. This uses the diversity of the generated solution to find a better solution with a shorter route in a reasonable amount of computational time. Furthermore, we propose to apply the three-opt algorithm to the completed subtour and the k-opt algorithm to the subpath gained from the experience of the subpath. Finally, to verify the effectiveness of the proposed EACS algorithm, the algorithm is tested on some CVRP instances and is compared with one of the state-of-the-art methods, namely, the enhanced simulated annealing algorithm. The comparative study showed a better performance of our EACS compared to the enhanced simulated annealing algorithm.