jQuery accordion menu

Add the menu_class argument with value of cd-accordion-menu to your code, so that it looks like this:

<div class="menu-container">
    <nav id="site-navigation" class="main-navigation" role="navigation">
        <?php wp_nav_menu(array(
        'theme_location' => 'primary',
        'sort_column' => 'menu_order',
        'menu' => 'Categories',
        'container_class' => 'main-menu',
        'menu_id' => 'primary-menu',
        'menu_class' => 'cd-accordion-menu'
        ) ); ?>
    </nav><!-- #site-navigation -->
</div><!-- #menu-container -->

You can see more options to change here: https://developer.wordpress.org/reference/functions/wp_nav_menu/

About learning jQuery, it’s really very easy. Just go to http://api.jquery.com/ and read as many pages from left menu as possible. It will definitely help.

For using jQuery with WordPress, preferrably enqueue it to prevent conflicts due to duplicate addition in source code. (read more here: https://developer.wordpress.org/reference/functions/wp_enqueue_script/ )