Unless you have the original OSX DVD for your iMac I doubt you will be able to install macOS from your friends DVD. If your macOS has been updated, then the tools on the DVD may be too old and not safe to use on the newer OS.
What version of macOS is currently installed on the iMac?
How far does the progress bar get? If it is less than halfway then you may be able to see errors or at least where it stalls out by booting with Verbose Mode which displays the boot log on the screen during the first part of the boot process.
Try booting into Safe Mode which will disable any unnecessary drivers, Startup & Login items, as well as running a file system check and it will remove some temp & cache files.
See if you can run the Apple Hardware Test.
You can try booting into local Recovery Mode using Command + R to run Disk Utility First Aid or to reinstall macOS. If macOS version 10.12.4+ has been installed on this iMac, then you may be able to boot into Internet Recovery Mode (Command + Option + R).
On an older iMac, it is very likely the hard drive is beginning to fail. Verbose Mode could reveal a failing hard drive if you happen to notice any disk I/O errors.