I bought it by mistake.
'Errore' — er-RO-re. Double 'r' — trill slightly.
A simple, honest explanation when you bought the wrong thing. This covers duplicate purchases, pressing the wrong button online, or picking up the wrong item in a rush.
'L'ho comprato' — the 'L'' is the direct object pronoun 'lo' elided before 'ho'. 'Per errore' means by mistake or in error. It is a fixed adverbial phrase. For feminine items: 'L'ho comprata per errore'.
Ho preso quello sbagliato.
I took the wrong one.
Casual version.
Me ne serviva uno diverso.
I needed a different one.
Explains the underlying need.
Ho cliccato per sbaglio.
I clicked by mistake.
For online purchases.
Admitting a mistake honestly tends to work well in Italian shops. Staff appreciate directness and are more willing to help when the reason is clear and the item is in perfect condition.