The side of the loop closer to the straight wire experiences a stronger attractive force than the repulsive force on the farther side. The forces on the other two sides cancel out. This results in a net attractive force, causing the loop to move toward the wire.