If you want to recover photos from your old Apple ID, the first thing you need to do is to sign in with your old Apple ID and then you can recover your photos.
You mentioned that your photos are on an old iPhone but you forgot your old Apple ID, thus, you can try to start your old iPhone and then go to settings to find your Apple ID.
If you can remember your old Apple ID, you can sign in to your old Apple ID in iCloud Drive at iCloud.com. Then click on Settings and choose Restore Files under the Advanced section. Click Restore to confirm.
Or else, you can send your old iPhone to the local professional repair send to ask for help.