Hook module placement I have the following file named background_image_style.module 

In my Drupal 8.3.3 site, paragraphs.module is at MySite/web/modules/contrib/paragraphs/paragraphs.module.

I installed the site and all contributed modules with Composer.

composer require drupal/paragraphs
vendor\bin\drupal module:install paragraphs


Where does my hook module go? (I just copied it in where the paragraphs.module is.) Are there any other overhead steps that needs to be done (e.g. editing other files)?

I tried several locations and cleared the cache each time.

    /**
     * Implements paragraphs().
     */ 
    function background_image_style_preprocess_paragraph__banner(&amp;$variables) {
      $paragraph = $variables['paragraph'];
      if (!$paragraph-&gt;field_image-&gt;isEmpty()) {
        $image = $paragraph-&gt;field_image-&gt;entity-&gt;url();
        $variables['attributes']['style'][] = 'background-image: url("' .                 $image. '");';
        $variables['attributes']['style'][] = 'background-size: cover;';
        $variables['attributes']['style'][] = 'background-position: center         center;';
      }
From Where to Put the Module Files:


  Manual import location
  
  If you import a module 'manually', you should place your module in that same default recommended location, HERE:
  
  [d8-root]/modules/HERE
  
  [Themes: [d8-root]/themes/HERE]


It's a good idea to keep custom and contrib modules separate, hence Drupal Project putting contributed modules into their own folder; following on from that, there's a pretty common convention to place custom modules under [d8-root]/modules/custom/. But you don't have to, you can use whatever hierarchy you like under /modules, Drupal will pick up anything it finds recursively.

After it's in place, don't forget to enable the module, or it won't do anything.