Add Codepen animation as Preloader to WordPress

1) In which location should I add the codepen html code?

If you’re using a child theme, then for example, you could copy parent theme header.php file to your child theme directory and add the required html to that file after <head>.

If you’re developing your own theme, then put the markup wherever you want on.

Or you could also add the markup with an action hook (e.g. wp_footer or theme specific action hook, if available). This could be added to your theme’s functions.php file or a custom plugin file. Something along these lines,

add_action( 'wp_footer', 'prefix_my_preloader' ); // or other suitable template hook
function prefix_my_preloader() {
  ?>
    <div id="cooking">
      <!-- rest of the markup -->
    </div>
  <?php
}

2) In which location should I add given CSS?

Styles can be added either to your (child) theme’s styles.css file, Customizer’s Additional css section (if available, but maybe not the best option), or a custom css file that is located either in your (child) theme or custom plugin directory. Remeber to include the styles if you’re using a custom css file.

3) And in which location should I add any required JS to make it work
like it happens here

Scripts can be added either to your (child) theme’s scripts.js file or a custom js file that is located either in your (child) theme or custom plugin directory. Remeber to include the scripts if you’re using a custom js file.

P.S
You can also add the styles and scripts with custom functions using action hooks as mentioned on the accepted answer for Add CSS animation as Preloader to WordPress. You would then add these functions either to your (child) theme’s functions.php or a custom plugin file.