Task scheduling is an essential component of any cloud computing architecture that seeks to cater to the requirements of its users in the most effective manner possible. It is essential in the process of assigning resources to new jobs while simultaneously optimising performance. Effective job scheduling is the only method by which it is possible to achieve the essential goals of any cloud computing architecture, including high performance, high profit, high utilisation, scalability, provision efficiency, and economy. This article gives a framework based on chaotic grey wolf optimization (CGWO) for efficiently scheduling tasks in cloud fog computing. Task scheduling is done with CGWO, ant colony optimization (ACO), and min-max algorithms. CloudSim is used to implement task scheduling algorithms. Makespan time required by CGWO algorithm for 500 tasks is 73.27 seconds. CGWO is taking minimum resources to accomplish the tasks in comparison to ACO and min-max methods. Response time of CGWO is also 3745.2 seconds. CGWO is performing better in terms of Makespan time, response time and resource utilization among the methods used in the experimental work.