Heat engines do turn heat into mechanical energy (motion).
What they don't do is do this with infinite efficiency.
In practice, Carnot engines (heat engines) tend to operate at efficiencies between about 20 to 50%, with an average close to 30% percent. This means that most thermal electrical generation produces roughly three times as much heat as it does electricity. This applies across thermal mechanisms: diesel generators, gas turbines, coal-fired steam, and nuclear-powered steam plants.
There's some room for increased efficiencies, and multi-pass systems, or systems with incorporated thermal applications (district space heat, industrial heat, food preparation) can achieve higher net efficiencies, though I believe the peak is around 60%, and that is rarely achieved.
The other parts of the generating cycle are far more efficient. Generators typically operate well above 90% efficiency (mechanical energy in to electrical energy out), and distribution typically sees about 6% losses.
But that first thermal step costs a lot. There's no such thing as a free lunch.
This is true whether you use an engine, a river, or a solid-state fully electronic device. Even humans must obey this law, and indeed there has to be some air movement for us to cool down using our sweat, and interrupting or changing that air movement costs energy and therefore increases entropy somewhere.
Heat engines are most efficient when the temperature difference between the hot and cold side is high, so you need to keep it that way to extract energy.
A nuclear power plant achieves this by converting extreme heat from a small, but very angry rock to a huge lake of slightly warmer water.
There exist reactor designs which operate at higher temperatures, thus increasing efficiency, but they're complicated as everything needs to be more heat-resistant.