Without a
snorkel, no, subs could not run their diesel's underwater. The engines would quickly suck all the breathable air from the boat, and replace it with toxic exhaust.
With the addition of a schnorkel, subs could run their diesels while submerged, but only very shallow. The pipe was much larger than a periscope, and therefore easier to detect, so they couldn't use it when approaching ships to attack.
CO2 is heavier than Oxygen and Nitrogen, which are the main components of 'air' (21% and 76% respectively), while CO2 is a component of 'air' (about 2%). So yes, CO2 would settle lower in the boat, but it wouldn't take long for it to fill up. Using compressed air to vent the boat worked a little, but you didn't want to waste the compressed air, as you needed it for driving the boat. Also, in order to vent the air, and it depended on the system they used, you may have to over pressurize the boat to force the air out, and then you'd compress the sailors too. You'd then end up with the same problems divers face with decompression sickness. That could be avoided with a negative pressure pump, sucking the air out, but it would cause much discomfort if the guy running the valves varied the pressure slightly (Think about driving down a big hill quickly, or in an airplane, having to equalize your ears).
I may be wrong here, as it's just supposition on my part.