If the checkbox is within the gallery you need to link it with any value in the gallery datasource, otherwise every time you refresh it, your checkbox will assume the default value, it means unchecked or checked for all records in the gallery.
If you want the checkbox to work like record selecting in the gallery, you need to add a column in you gallery datasource.
AddColumn(MyDataSource, "Check", false)
The default in the checkbox must be ThisItem.Check.
you need to add in the "on Check" Patch(MyDataSource, ThisItem,{Check: True})
you need to add in the "on UnCheck" Patch(MyDataSource, ThisItem,{Check: False})