They’re both using the same material. So go the F5-tab and if you see a number after you material name, press that. It pops up a question “OK - Single user”, press that. Now they are two different materials.
If you don’t see the number, you have linked duplicates made with alt-d. Then you go first to the F9 tab to separate the meshes. There you see something like “ME: Cube” and a number after that. Press the number, press the question, and go to part 1 of my reply.