How can I render or change programmatically the responsive image style for an image field for a paragraph?
You don't need to swap the image, only the information how to render the image. And you can't do this in a field template. This is only possible in the paragraph template, where both fields are available:

function mytheme_preprocess_paragraph(&amp;$variables) {
  if ($variables['paragraph']-&gt;hasField('field_image_style')) &amp;&amp; isset($variables['content']['field_image']['0']) {
    $image_style = $variables['paragraph']-&gt;field_image_style-&gt;value;
    $variables['content']['field_image']['0']['#responsive_image_style_id'] = $image_style;
  }
}