First time purchase of cycling shoes?
You would probably want a shoe that's designed for an SPD clipless pedal. In my experience most gym spinning bikes use an SPD type pedal. As long as your road bike has SPD pedals, you can use the same shoes.

I suggest going to a bike shop or outdoor store with a good selection of cycling shoes and try on a few pairs so that you get a good fit. Good fit is subjective, so that's why I say to try on a few. Mountain bike shoes are probably the best option. They look like sneakers and have SPD mounts. Also, the SPD cleats are recessed in the tread of mountain bike shoes, which makes walking more comfortable. In addition they work just fine for occasional road bike riding...that is as long as you have SPD pedals on your road bike... 

Now that I think about it. It's possible that your gym spinning bikes are equipped with "Look" type pedals. If that's the case, you'll need a road shoe with cleats that match your road bike. I travel a lot and take spinning classes when I travel; and very rarely run into spin class bikes with Look pedals. So, odds are, you want an SPD compatible shoe. 

For the typical spin class bike, you can adjust...


The seat height
The seat fore/aft position in relation to the handlebars
The handlebar height


Often, but not always, the spin bike will feature a double-sided pedal. Typically, one side is "strap in" and the other is quite often SPD cleated. 

So, when you get to your spin class, make sure that the bike is adjusted correctly. For me, I try to duplicate my road bike as closely as possible. Otherwise, and especially if you're new to it, the spin class leader should make sure that you have made the correct adjustments on the bike.

And how to choose the shoes? Complicated? Not really. With the OP criteria, just get a pair of good-fitting mountain bike (SPD) shoes, and you'll be fine.