Best configuration of my.cnf for make fast Magento navigation
innodb_buffer_pool_size = 5G --> change to 70% of available RAM (after excluding other apps)

tmp_table_size = 2G --> only 500M

But... Neither of these is likely to solve the problem you pose.

You "can't configure away a performance problem".  Instead, you must provide the slow queries and the schema (SHOW CREATE TABLE).  The solution may be as simple as adding a suitable composite index.