Smoothly Rotate Object Towards Target Object

I want to rotate my player vehicle into the target object direction/side. Though the following image, I have tried to explain my point in a better way:

I want to rotate my below tank object towards another tank object so that it can point into that direction.

I have written this code for this purpose but it is not working:

IEnumerator DoRotationAtTargetDirection(Transform opponentPlayer)
{
    Quaternion targetRotation = Quaternion.identity;
    do
    {
        Debug.Log("do rotation");
        Vector3 targetDirection = opponentPlayer.position - transform.position;
        targetRotation = Quaternion.LookRotation(targetDirection);
        Quaternion nextRotation = Quaternion.Lerp(transform.localRotation, targetRotation, Time.deltaTime);
        transform.localRotation = nextRotation;
        yield return null;

    } while (Quaternion.Angle(transform.localRotation, targetRotation) < 0.01f);
}

I just want to smoothly rotate and stop towards a target object. Please share your suggestion regarding this.

Quaternion.LookRotation(targetDirection) defines a rotation in world space, but you are trying to change the local rotation of the object. Try:

Quaternion nextRotation = Quaternion.Lerp(transform.rotation, targetRotation, Time.deltaTime);
transform.rotation = nextRotation;

But I would use RotateTowards instead

 Vector3 targetDirection = (opponentPlayer.position - transform.position).normalized;
 targetRotation = Quaternion.LookRotation(targetDirection);
 transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation , Time.deltaTime);
 yield return null;

Also, don’t forget to change your condition to

while (Quaternion.Angle(transform.rotation, targetRotation) > 0.01f);