Reading the UXP docs you’d find an answer to your question. Basically you have two options: 1) either you rename the file as an operation of its parent folder (as documented here):
await aFolder.renameEntry(fileEntry, "New name.jpg");
Or 2) by moving the file itself to a new location, in its original parent folder (i.e. equivalent to how you would rename a file through command line):
await fileEntry.moveTo(aFolder, {newName: "New name.jpg"});