Config::set('services.mailgun.username', $data['app_name']);
I believe doing it this way limits your change to only being in the current request as it will not persist beyond the execution of the code it's running in.
If you want it to persist, you will need it to update in the .env file.
file_put_contents(app()->environmentFilePath(), str_replace(
'MAILGUN_USERNAME='.env('MAILGUN_USERNAME'),
'MAILGUN_USERNAME=updatedUser',
file_get_contents(app()->environmentFilePath())
));
then you need to clear the config.
Artisan::call('config:clear');
If you do this often, it may be a good idea to build a helper method to do all of this in one step.