As you said - My Apple ID was connected to my old phone number which I don’t remember ---so the trusted number is forgotten .
Then you said - account had no trusted devices =====to set up two factor authentication at least a single trusted number is essential to set up the account completely .
After that you wrote - I remember the password and the username but when I log in it asks me for a verification code that is sent to my old number and no other option is given to me.
You remember the user name ( Apple ID and address and its password ) the account is suspicious as you already said account had no trusted devices , that you better know , use another new trusted number to sign in with Apple ID and password see the articles https://support.apple.com/en-in/HT204915
https://support.apple.com/en-in/guide/iphone/iphd709a3c46/ios
https://support.apple.com/en-us/HT204974