How to adjust only the template gallery

There are several possible things affecting your gallery. The first most basic one is WordPress Core itself. The gallery shortcode is created in /wp-includes/media.php. If you had a default theme and no plugins, that would be controlling it.

However, the behavior you describe is being added, either by a theme or a plugin. A theme is the most likely, so check there first. A likely spot would be in functions.php though it could be in some other file.

Finally, plugins can also override the default gallery behavior, so you may want to deactivate your plugins to confirm the behavior is coming from the theme.

Then:

If it’s the theme, and you are not already using a child theme, you can create a child theme and override the current theme’s behavior.

Or, if it’s a plugin, you will probably just want to deactivate that plugin and go with the theme functionality – or again, create a child theme if you don’t want your theme’s functionality.

Finally, if it’s the theme and you are already using a child theme, the only option is to edit the child theme itself. The problem there is if the authors ever release updates to the child theme and you update, you will lose your customization. So, this works best if you only have a parent theme, and can easily create your own child theme.