How to remove field from form and configuration?
change this line

-&gt;set('enabled_content_types', $form_state-&gt;getValue('enabled_content_types')) 


to

-&gt;clear('enabled_content_types')


In Drupal, go to config form and click save. 

Side Note: Alternatively, you could also delete the config via Drupal Console or Drush as mentioned in the answers here, How do I remove a configuration object from the active configuration?

Now you may now remove the relevant code. 

public function buildForm(array $form, FormStateInterface $form_state) {
  $mymodule_config = $this-&gt;config('mymodule.settings');

  $types = \Drupal::entityTypeManager() // remove
    -&gt;getStorage('node_type') // remove
    -&gt;loadMultiple(); // remove

  foreach($types as $type) { // remove
    $content_types[$type-&gt;id()] = $type-&gt;label(); // remove
  } // remove

  $form['enabled_content_types'] = [ // remove
    '#type' =&gt; 'checkboxes', // remove 
    '#title' =&gt; $this-&gt;t('Enabled Content Types'), // remove
    '#description' =&gt; $this-&gt;t('content types .'), // remove
    '#default_value' =&gt; $config-&gt;get('enabled_content_types'), // remove
    '#options' =&gt; $content_types, // remove
  ]; // remove

  ...

  return parent::buildForm($form, $form_state);
}

public function submitForm(array &amp;$form, FormStateInterface $form_state) {
  $mymodule_config = $this-&gt;config('mymodule.settings');
    -&gt;clear('enabled_content_types') // remove
    -&gt;set('urls', $form_state-&gt;getValue('urls'))
    -&gt;save();
  parent::submitForm($form, $form_state);
}