This could happen when the form_id being passed in the donation API call is associated with an incorrect level_id that is not present on the form. As a result the campaign name shown on the Transaction tab of the Constituent record would be correct but the form name would be wrong as it will reflect the name of the form associated with the level_id being passed.