Optimization is a real challenge in fields like engineering design, machine learning, and computational intelligence. The main goal is to find the absolute best answer (global optima), but there are many small, local best answers (local minima) that can trap the algorithms. The Rastrigin function is a standard test for algorithms because of its tricky, multi-peaked landscape. This paper compares five key metaheuristic algorithms: Genetic Algorithm (GA), Particle Swarm Optimization (PSO), Simulated Annealing (SA), Differential Evolution (DE), and Grey Wolf Optimizer (GWO) across three problem dimensions (2D, 10D, 30D). Our experimental results show that GWO consistently performs better in high-dimensional tests, reaching a best fitness of 57.37 in 30D problems, which is significantly better than 106.69 for PSO and 134.99 for GA. It is also worth noting that GWO kept its execution time steady at about 0.13 seconds across all dimensions, giving us a great balance between finding a good answer and being fast. These findings offer practical advice for picking an algorithm for complex optimization tasks, highlighting GWO as a strong choice for difficult high-dimensional problems. © 2025 IEEE.