I created the below collection:
Collect(KeyValuePairs,
{
Key: "Key1",
Value: "Value1_1"
},
{
Key: "Key1",
Value: "Value1_2"
},
{
Key: "Key2",
Value: "Value2_1"
},
{
Key: "Key2",
Value: "Value2_2"
},
{
Key: "Key3",
Value: "Value3_1"
},
{
Key: "Key3",
Value: "Value3_2"
},
{
Key: "Key4",
Value: "Value4_1"
},
{
Key: "Key4",
Value: "Value4_2"
}
)
I created two vertical galleries as shown below:

The left gallery (Gallery3) has a checkbox (CheckBoxCanvas1) and the label on the checkbox is set to "ThisItem.Value" and Items is set to "Distinct(KeyValuePairs,Key)"
The right gallery has a couple labels just to display items in the collection and Items is set to "Filter(KeyValuePairs,Key in Filter(Gallery3.AllItems,CheckboxCanvas1.Checked).Value)".
You could also do the comma-separated text field (call it TextCanvas2) thing that you mentioned by setting the gallery items to: "Filter(KeyValuePairs,Key in Split(TextCanvas2.Text,","))"