Density-based spatial clustering of applications with noise (DBSCAN) has been used to cluster data with arbitrary shapes which clustering is done based on the density among objects in data. Given that DBSCAN is a proper tool for identifying outliers and clustering non-convex data, it can be used for automatic clustering of non-convex data and covered the weakness of most automatic clustering algorithms in not recognizing non-convex clusters. So, in this paper, a new automatic clustering algorithm is introduced which is a combination of DBSCAN and grouper fish - octopus (GFO) algorithm. GFO-DBSCAN finds the best number of clusters in two main steps in an iterative manner. In the first step, the values of \(esp\) and \(minpts\) are generated by GFO algorithm and in the second step, the clustering of data is performed using DBSCAN algorithm with \(eps\) and \(minpts\) that are generated in the previous step. After each clustering, using correct data labels, and cluster centroids, the Calinski-Harabasz (CH) index is calculated. Finally, after passing some iterations of GFO, the best number of clusters is reported. In this study, three categories of data are used to measure the performance of the GFO-DBSCAN algorithm. Also, DBSCAN is compared with ACDE, DCPSO, and GCUK algorithms. According to the results, GFO-DBSCAN has achieved the optimal number of clusters in most data and has outperformed other well-known algorithms.