A new auto-increment value is generated only if you don't specify a value for the AI column.
mysql> create table MyTable (id int auto_increment primary key, x int, unique key(x));
mysql> insert into MyTable values (1, 100), (2, 200);
mysql> insert into MyTable (id) values (2);
ERROR 1062 (23000): Duplicate entry '2' for key 'PRIMARY'
In this example, I can create a duplicate id value only if I specify a value in my INSERT. In this case, it skips allocating a new AI value.
Whereas if I create a duplicate value conflicting with my secondary unique column, I might not give a specific value for the id. This would cause the AI to generate a new value, but ultimately the INSERT fails because of the duplicate in the secondary column, and the AI value generated is lost.
mysql> insert into MyTable (x) values (200);
ERROR 1062 (23000): Duplicate entry '200' for key 'x'