Cloud computing is revolutionizing the delivery of on-demand scalable and customizable resources. With its flexible resource access and diverse service models, cloud computing is essential to modern computing infrastructure. In cloud environments, assigning Virtual Machines (VMs) to Physical Machines (PMs) remains a complex and challenging task critical to optimizing resource utilization and minimizing energy consumption. Given the NP-hard nature of VM allocation, solving this optimization problem requires efficient strategies, usually addressed by metaheuristic algorithms. This study introduces a novel method for allocating VMs based on the Harris Hawks Optimization (HHO) algorithm. HHO has exhibited the capacity to provide optimal solutions to specific issues inspired by the hunting behavior of Harris's falcons in the natural world. However, there are often problems with convergence to local optima, which affects the quality of the solution. To mitigate this challenge, this study employs a tent chaotic map during the initialization phase, aiming for enhanced diversity in the initial population. The proposed method, Enhanced HHO (EHHO), has superior performance compared to previous algorithms. The results confirm the effectiveness of the introduced tent chaotic map improvement and suggest that EHHO can improve solution quality, higher convergence speed, and improved robustness in addressing VM allocation challenges in cloud computing deployments.