My Samsung contacts app (Galaxy s21, Android 13) has this "history" button but only shows calls in the history, not SMS. But I wonder how the contacts app is getting this information? The call log is a common feature accessible to any app with the phone permission, but that doesn't include SMS. Any app with permission to read the message database could keep a history, but neither of my contacts apps even asks for that permission (of course the call log is updated by the phone app, and my Samsung Phone app does have SMS permissions, but doesn't seem to use them to add texts to the log).
I'm inclined to ask what SMS app is being used here, because maybe it is responsible for adding these to whereever this particular contacts app is getting the history from?
As for where the data are stored, generally in a database in /data/data/<some app or other>. In other words, it's highly likely that the only way to clear this is to clear data for whatever app is storing them in the first place: which, depending on what app it is, may have other consequences. Remember that I don't know whether that is your contacts app, because I don't know where it's getting this information from (I've never seen a contacts app do this). Some data that are shared between apps are stored by a separate app that provides access to them to other apps, e.g. contacts are owned by a system contacts storage app rather than your Contacts app, and similarly for SMS (so clearing data for an SMS app does not delete your SMS, but clearing data for the message storage app would). If it is the contacts app itself that is storing this then clearing its data will remove it, but it might not be (I'd never clear something like that without making sure any important data I access through it are backed-up, even though if you enable "show system apps" you'll see a "Contacts Storage" app in your phone that is separate from the Contacts app).
As for removing the history button, as Danny says your only option will be to find a contacts app that doesn't have it. Or don't hand the phone to whoever it is you don't want to see these messages in your history (I say that because if there's nobody else involved then so what? You know the messages were sent/received regardless of whether they appear in that list, and if you don't want a reminder just don't press the history button for that contact, so if it's only you it doesn't seem a big problem).