How to enable a field programmatically
You enable the field by adding a widget to the default form display mode:
$display_repository = \Drupal::service('entity_display.repository');

// Assign widget settings for the default form mode.
$display_repository-&gt;getFormDisplay('node', 'mybundle')
  -&gt;setComponent('field_desc', [
    'type' =&gt; 'string_textfield',
  ])
  -&gt;save();

See Add content type field programmatically