El Hamdaoui, 27, was a regular in the Ajax side under former manager Martin Jol, but he found himself on the sidelines after a dispute with manager Frank de Boer.
The Moroccan still had two years remaining on his Ajax contract, and he becomes the third new signing this summer for Fiorentina, joining Egyptian Ahmed Hegazy and Palermo defender Mattia Cassani.