Potential energy and torque in a magnetic field

If you have a coil with its magnetic dipole moment perpendicular to a uniform magnetic field, μ × B says that there will be maximum torque since sin90 is 1. But at the same time, -μ dot B gives the potential energy and cos90 is 0. What I don't understand is how you can have torque at this angle, but no potential energy. If you rotate the coil to a perpendicular angle and release it, it'll automatically rotate until the angle is 0. If there were no potential energy wouldn't it just stay in that position?

The zero of potential energy here is not its minimum. When the magnetic field and dipole moment are aligned, you get [itex]-\mu \cdot B = -|\mu||B|[/itex]. The torque is trying to align the dipole moment to this minimum energy configuration.