I remember years ago in school my chemistry teacher showed us a tangled wire that untangled itself when a current is applied, can anyone suggest what the material may be?
You are almost certainly thinking of nitinol wire or "memory wire".
However, it's not electricity that makes it untangle. It's heat. Running current through the wire is just a way to heat it.
When at room temperature, nitinol wire can be easily bent. When heated, it acts like a spring trying to go back to its unbent shape. You can see the same effect by twisting some wire, then dropping it into boiling water.
There have been "electric pistons" built on this principle. The piston is driven by a spring of memory wire. When cold, the piston is easily compressed. When the spring is heated by running electric current thru it, it pushes against the piston harder than what it took to push the piston in when cold. This effect has niche uses but is mostly a curiosity. The overall cycle is not very efficient.