To rename a diagram attachment, open the Attachments view by clicking on the "..." menu in the upper right corner and then click on "Attachments".
Click on "Properties" of the attachment and assign it a new file name in the form.
Repeat the same steps for the image (PNG) attachment. In the above example, when renaming "My diagram" to "My renamed diagram" you should also rename the "My diagram.png" to "My renamed diagram.png".
Once diagram and its image are renamed, it's time to reflect those changes onto the page. For that, we recommend using Confluence Source Editor plugin. It's free.
Once installed, click on Edit page, then click on <> in the upper right corner to open the source of the page.
Locate the element called "diagramName" and update its value to match the name of the diagram attachment. Click 'Apply and then save the page'.
This needs to be done for every macro that references the renamed attachment.
It is possible the diagram or its image are referenced by a link on a page or another diagram. Those links need to be updated too.