Interesting this should even be asked because NOT converting mechanical energy to heat seems to be the holy grail of engineering.
However, to answer the question, in a word; FRICTION
Your car brakes...
An electrical generator or Dynamo. The mechanical energy moves a magnetic field relative to electric coils and creates electricity. Little Dynamos on bicycles provide light at night.
You use an electrical generator. The shaft can be turned by any source ofmechanical energy . . . such as falling water, a windmill turned by wind, aturbine turned by steam, a belt turned by a gas...