Rename a tablename using db_schema(Declarative schema) in Magento 2.

In Magento 2, You can create a new table using db_schema.xml file. After creating a table you want to rename a table name, You can rename a table using declarative schema.

New Table(mycustom_table) db_schema.xml file,

Now you must have to run generate-whitelist command to generate db_schema_whitelist.json file,

php bin/magento setup:db-declaration:generate-whitelist –module-name=Vendorname_Packagename

Where Vendorname_Packagename is your Vendor and Packagename.
Now you can change the table name using below tag in the XML file,

<table name=”rename_tablename” onCreate=”migrateDataFromAnotherTable(mycustom_table)”>

where rename_tablename is your new table name and mycustom_table is your old table name in the above tag.

The new db_schema.xml file will be,

Run command,
php bin/magento setup:upgrade

You can check your table name is replaced with a new name.