Page content loaded
Does this happen in the iOS App Store with an iPhone?
Does the main account in Settings match the account for the iTunes Store and App Store? If not, that may be a source confusion for the system.
In the App Store app, select the upper-right icon/avatar/photo, to set the correct account details, before searching/selecting an app to download.
A request for an old Apple ID password is often caused by updates to apps/purchases that were made when using the old ID. This might happen if you are using a device purchased from someone. Those purchases are tied to the old ID and can't be transferred. One option is to delete the apps/purchases made by the old ID and download them using the current ID.
Question: Apple ID