code: def copy_fields(layer, fields_to_copy):
      
      for field in fields_to_copy:
  
          index = layer.fields().lookupField(field)
          if index != -1:
  
              layer.startEditing()
  
              source_field = layer.fields().at(index)
              new_field = QgsField(source_field)
              new_field.setName(fields_to_copy[field])
  
              layer.addAttribute(new_field)
  
              new_index = layer.fields().lookupField(fields_to_copy[field])
  
              for feature in layer.getFeatures():
                  attributes = feature.attributes()
                  source_value = attributes[index]
                  layer.changeAttributeValue(
                      feature.id(), new_index, source_value)
  
              layer.commitChanges()
              layer.updateFields()
docs: Copy fields inside an attribute table.
  
      :param layer: The vector layer.
      :type layer: QgsVectorLayer
  
      :param fields_to_copy: Dictionary of fields to copy.
      :type fields_to_copy: dict