To display the listing as categorized product links, go to Catalog Settings > Catalog Design and select the Categorized Product Tree template:
You can also select a different template for products. To display them as links, please select the Categorized Product Tree.
After you save the settings, your product list will look like this:
When you click on the category name on the list, it will collapse.