iMac won't boot to internal drive, usb sticks - Apple hardware test extended fine
You should try to boot your OS in verbose mode or safe mode to see whether you can fix it or not.

https://support.apple.com/en-us/HT201262

https://support.apple.com/en-us/HT201573

If you really need to reinstall Mac OS X Yosemite, I'd suggest you run this script from any Mac, you need to have Yosemite downloaded in /Applications.

#!/bin/sh
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ Yosemite.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app

# Convert the boot image to a 8GB sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite
hdiutil resize -size 8g /tmp/Yosemite.sparseimage

# Mount the sparse bundle for package addition
hdiutil attach /tmp/Yosemite.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build

# Copy Packages and Base System files to the sparse bundle
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/
cp -p /Volumes/install_app/BaseSystem* /Volumes/install_build/

# Unmount the installer image and sparse bundle
hdiutil detach /Volumes/install_app
hdiutil detach /Volumes/install_build

# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits /tmp/Yosemite.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Yosemite.sparseimage

# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/Yosemite.sparseimage -format UDTO -o /tmp/Yosemite
rm /tmp/Yosemite.sparseimage
mv /tmp/Yosemite.cdr ~/Desktop/Yosemite.iso


Credit goes to the person who wrote that script for Maverick

You can then restore the ISO using Disk Utility on a 8Gb USB Stick and it will be bootable.