How can I change the name of migration database in database array?
migrate is the default key used by the SqlBase class which is the base for the D7 source plugins. Its documentation explains in detail how it determines what key to use and how it can be changed. Of relevance:

As described above, the default source database is $databases['migrate']. If the source plugin needs another source connection, the database connection parameters should be added to the $databases array as, for instance, $databases['foo']. The source plugin can then use this connection by setting 'key' to 'foo' in its configuration.

So update the source.key value in your migration configuration to foo then re-import that configuration to change the default key used for that migration source.