Some scanner software automatically senses where the image is (and only scans that area) but, in many cases, you need to define the area to be scanned.
I've not got an HP scanner but most scanners come with software which provides a 'preview' function. (NB: You'll normally only access this if you open the relevant scanning program on your PC. Pressing a 'scan' button, on the actual scanner, often bypasses this stage).
If you can find a 'preview' (or similarly named) facility in the software, it should perform a quick scan which will show you a 'draft' (i.e. low resolution) version of what will be scanned. From your post, I'd expect that the picture you would see would be a white (A4) rectangle, with the photo in one corner. However, you should also see (at the very edge of the white rectangle), lines which define the edges of the area to be scanned. You can click on these lines and (while keeping the mouse button held down) drag them to meet the edges of the photo. Then when you click on 'Scan', only the photo will be scanned.
Chris