Next time you start the installation - choose "custom" mode, and first delete all existing partitions on the hard drive before proceeding.
You've said it came with Windows 8, so HP did not try to make it work with Windows 7.
I would stick with Windows 10 (it looks almost the same as Windows 7).