How to downgrade to OS Mavericks 10.9.5 from a new pre-installed Yosemite 10.10.1 iMac late 2013?
The first pre-installed OS on the iMac14,1/iMac14,2 was Mac OS X 10.8.4. You may install any OS version newer than that one.

If you have any personal data on this Mac, save it to an external drive.

After creating a bootable thumb drive using the Mavericks installer, boot to the thumb drive, erase the main disk and install Mavericks.

Restore your personal data from the external drive. Some of the data (Photos library, probably your Mail data) - if you had any - is not backward compatible with the apps (iPhoto, Mail) used in Mavericks.