How to use my menu PHP code as sidebar?

wp_nav_menu is a standard WordPress function, so you would just copy/paste that PHP code into sidebar.php using whatever additional arguments you need. However, since the theme has a sidebar.php it probably has widget areas, so I would look in Appearance > Widgets in the dashboard and look for a sidebar widget area.

In there, I would create a textarea widget into the sidebar widget area and copy/paste the shortcode into that widget. It should then render the menu in the same way as the PHP code.