In terms of heat, the cannon will leave less heat in the ship, as the extreme greater part of the heat will leave with the combustion gasses of the propellant. The only heat that remains is the tiny amount that transferred from the propellant to the mechanism (breech, barrel) of the cannon in the very brief fraction of a moment that it is actually firing.
By contrast, the railgun consumes an enormous amount of electrical energy, which needs to be generated, somewhere on your ship. This makes heat. It then uses this energy to propel the projectile, with significant losses, imparting more heat.
In terms of recoil, the cannon imparts a LOT more force.
You are accelerating not just the projectile, but also all of the gas behind it, all in the same direction.
Here is a typical lowvelocity practice cannon round.
That bit on the right is what you throw at the enemy.
That long tube on the left is the propellant charge that provides the push, and is also thrown in the general direction of the enemy. Every gram of mass, both in the projectile and the propellant, imparts recoil on your firing cannon and thus on the cannon's ship.
However, this whole discussion is moot.
The whole reason one would use a railgun in a space battle, is because such battles will be fought at much greater ranges, and much greater relative speeds, than any land or naval battle. Your projectiles need to get to the enemy at high speed, to have any chance of actually hitting the target.
A chemical propellant cannot accelerate a projectile faster than the speed of sound in the propellant. This limits maximum projectile speed to about 2km/s, in practice actually less.
A railgun is limited only by the energy density your materials can withstand, and even current primitive examples can reach speeds of 6.5 km/s, the theoretical limit is , well... unlimited.