The gray wolf optimizer (GWO) and the whale optimization algorithm (WOA) are two esteemed optimization algorithms, and their various modified versions are proposed in recent years for different applications. The GWO and WOA simulate the hunting method of gray wolves and humpback whales, respectively. These algorithms have several operators for moving the search agents toward the optimum solution in the search space. But, the GWO and WOA encounter some problems such as falling in local optima and slow convergence. Various proposals have been presented so far to develop innovative and novel meta-heuristic optimization methods. Some of them are based on adding special evolutionary operators or local search steps to existing algorithms. Some others are established based on the combination of previous methods or applying the chaos theory in them. A novel hybrid method defined as chaotic GWO and WOA (CGWW) is proposed in this paper by modifying the WOA, merging it with GWO, and applying the chaotic maps. Also, the chaotic maps have been used in the CGWW algorithm to adjust the movement parameters and initialize the search agents. The combination of different operators of the mentioned algorithms and using the chaotic maps increases the exploration and exploitation power of the proposed algorithm and thus causes to obtain better results. Twenty-three mathematical benchmark functions are used to evaluate the CGWW algorithm. Besides, the proposed algorithm is applied for solving the feature selection problem in intrusion detection systems, which is intrinsically multi-objective. The proposed algorithm finds competitive results in contrast to other well-known meta-heuristic algorithms in most of the experiments. It can avoid local optima and find the global optimum in most cases using its balanced exploration and exploitation ability.