With the rapid advancement in technology, numerous advanced vehicular applications have emerged that generate large volumes of data that need to be processed on the fly. The vehicles' computing resources are limited and constrained in processing the huge amount of data generated by these applications. Cloud data centers, which are large and capable of processing the generated data, tend to be far away from the vehicles. The long distance between the cloud and the vehicles results in large transmission delays, making the cloud less suitable for executing such data. To address the long-standing issue of huge transmission delays in the cloud, edge computing, which deploys computing servers at the edge of the network, was introduced. The edge computing network shortens the communication distance between the vehicles and the processing resources and also provides more powerful computation compared to the vehicles' computing resources. The advantages offered by the vehicular edge network can only be fully realized with robust and efficient resource allocation. Poor allocation of these resources can lead to a worse situation than the cloud. In this paper, a hybrid Marine Predatory and Particle Swarm Optimization Algorithm (MPA–PSO) is proposed for optimal resource allocation. The MPA–PSO algorithm takes advantage of the effectiveness and reliability of the global and local search abilities of the Particle Swarm Optimization Algorithm (PSO) to improve the suboptimal global search ability of the MPA. This enhances the other steps in the MPA to ensure an optimal solution. The proposed MPA–PSO algorithm was implemented using MATLAB alongside the conventional PSO and MPA, and the proposed MPA–PSO recorded a significant improvement over the PSO and MPA.