If your MBPro shut itself off, that can be a failed hard drive, or maybe you simply lost power, and now the directory on the hard drive may be corrupted.
I would try booting to an external drive, or an OS X installer, then open Disk Utility (easy to find in the Utilities menu when you are booted to an OS X installer). You should be able to see the hard drive (or find it missing when the drive has completely failed)
Your post says that you were trying to simply erase the drive (with El Capitan installed), then install Yosemite.
Were you also wanting to save anything on that drive before you erased the drive?
If you don't need to save anything, you could just boot to your Yosemite bootable installer, erase the drive then (assuming the internal drive is still working.)
If you can't do anything with the drive, maybe not even visible in your Disk Utility, then it's a great opportunity to swap the internal drive with a new SSD (the SATA SSDs are quite inexpensive right now (You can find 500 GB SSD for less than $40), and end up with a 2009 MBPro that is much more responsive than when it was new... (replace the SATA ribbon cable, while you are inside, those fail, too... )