I don't know specifically about the chemicals used in naval guns, but modern handgun bullets have the oxidizer included in the chemicals inside the cartridge, so they ought to work in a vacuum. I suspect naval guns are the same for the same reasons, but I'll defer on that to anyone on here who actually knows. Even if present naval guns require atmospheric oxygen to ignite, the technology to include the oxidizer in the cartridge is clearly there, so there's no reason why it couldn't be done on a spaceship.
Presumably an artillery gun would work better in the vacuum of space than on Earth, because it doesn't have to overcome air resistance. Once the projectile leaves the barrel, it will continue moving in a straight line at a constant speed until it hits something. Not quite in real life, because space isn't 100% vacuum. It will hit dust particles etc that will eventually slow it down. But it will go a long way before that makes a significant difference.
If the battle is taking place in orbit, then gravity may eventually pull the shell toward the planet, where it will either burn up in the atmosphere, or not and hit the ground. I say "may" because if the shell is travelling faster than escape velocity it will just fly off into space.
I don't think losing air when you fire would be a big issue. Yes, you have to open the barrel to load another shell. I'd assume this would be done by machinery and not by people hand-carrying shells, in which case the whole mechanism could be in a part of the ship separate from the crew quarters, and where everything operates in a vacuum. Or if people need to hand load it, fine, you have airtight doors on the gun barrels. They'd presumably have to be pretty well sealed anyway so the force of the blast is directed outward, to propel the shell out of the barrel, and not into the firing ship, killing the gun crew.
Yes, you can have explosions in space. The key difference is that with no air, you won't produce a shock wave. If you want the shell to do more damage than just punching a hole in the enemy ship, it will have to be loaded with shrapnel.
Yes, the speed of an artillery shell is slow compared to orbital velocities. But if you and the target are both in the same orbit going in the same direction, your relative velocity is zero, and so the artillery shell will have the same effective velocity that it does here on Earth. The operative question is the delta-V of the target: how fast can it maneuver out of the way when it sees the shell coming. If you're at close enough range that the shell hits within a couple of seconds, maybe the target doesn't have time to react.
An artillery shell is limited in speed because all the impetus to get it moving has to come from one blast, and there are practical limits to how fast you can release energy. And even if you could impart a very high velocity very fast, the g-forces would damage or destroy the projectile. A rocket can go faster than a shell because it continues to expend energy to accelerate over time. That acceleration can add up to a higher total velocity.
Thus, I tend to doubt that space war will use artillery shells. Rockets seems more likely. Assuming that overall lasers or other "beam weapons" don't prove more effective.
An advantage of a simple projectile is that it is more difficult to counter. Guided missiles can be neutralized with electronic counter measures, i.e. doing something to confuse or disable the guidance system. But a simple dumb projectile isn't vulnerable to that kind of defense. If someone fires an artillery shell at you, the best defense is probably jumping out of the way. Maybe some kind of anti-missile.
Oh, I presume someone capable of building spaceships is capable of building targeting systems for their projectiles that can deliver them to the desired point with a high degree of accuracy, and make due allowance for movement of the target. As long as the target doesn't see the shell coming and take evasive action, I'd expect you'd hit almost every time.