Samples have HKDevice associated with them and you can determine what the local device is.
More information available here: https://developer.apple.com/documentation/healthkit/hkdevice/local()
You can also utilize this in predicates for queries.
Topic:
Health & Fitness
SubTopic:
Health & Fitness Q&A