If you have enabled iCloud Messages for all of your devices, message deletion on one device will be synchronised to your other devices.
Should you choose to de so, you can disable iCloud Messages on one or more devices. You don’t mention the installed iOS/iPadOS version for your devices; to disable iCloud Messages:
iOS/iPadOS 16.x
Settings > [Your Name / AppleID] > iCloud > [Apps Using iCloud] Show All > Messages > Sync This iPad - set to OFF
iOS/iPadOS 15.x and earlier
Settings > [Your Name / AppleID] > iCloud > Messages - set to OFF
If you only wish to delete received message from your iPad - but retain the benefits of synchronising your iPhone with iCloud - you can simply disable iCloud Messages on the iPad; while the iPad will continue to send/receive messages, deletion from iPad will not be synchronised with the iPhone.