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.