Gearbox, crankshaft and engine speed

Hello, I have a little question of understanding that I couldn’t solve with any book or Wiki Google entry: The crankshaft runs into the gearbox, gears translate the movement and the cardan shaft, which leads out the rear, runs at a different speed. Please correct me if the part is not correct. But how does the gearbox now adjust the engine speed, as you always read it? About the crankshaft? But it is driven by the engine and not vice versa? D Anke yourselves!