displaying content of custom post type

What do you have in loop-gallery.php? That’s the file which will show the content of the gallery post.

If you haven’t created a loop-gallery.php, you should create a file with that name and put it in the root theme folder. In that file you could put something like the following to show the content:

<div>
  <h2><?php the_title(); ?></h2>
  <div><?php the_content(); ?></div>
</div>

You could obviously put something more complex in that file, if you however don’t need more than that and you’re not reusing the snippet elsewhere in your theme you could simply do the following change to your code to get the same result:

while ( have_posts() ) : the_post();
  <div>
    <h2><?php the_title(); ?></h2>
    <div><?php the_content(); ?></div>
  </div>
<?php endwhile; ?>

Also, have you recently registered your custom post type? If so you may have to reset your permalinks (although that shouldn’t have anything to do with this specfic use case. To reset your permalinks, simply visit Settings > Permalinks and hit save. That will resave the permalinks on your site, including the new permalinks for the custom post type.