Conflict adding a second variable

(deleted)

I see a few issues with this program but I don't think that any of these are causing the issue that you described.

    if (buttonState1 == HIGH) {
      ledState2 = !ledState2;

This code has two issues:
(1) It mixes buttonState1 and ledState2. It could be intentional but probably not.
(2) It happens that ledState2 = !ledState2; works, but the documentation only specifies HIGH and LOW without saying what those values are.

(3) Debouncing does not distinguish between button 1 and button 2. It is unlikely that you will push them at almost the same time, but it could happen.
(4) When you are tempted to suffix variable names with numbers, it may be time to learn about arrays.
(5) Anything involved with time should be declared as unsigned long, not just long.
(6) You have not described anything about your wiring or about how you tested.

Very similar topic posted in the Spanish section

You set 'reading1' but use 'buttonState1'. I also think your debounce might be a problem. Try this:

const int buttonPin1 = 4;
const int buttonPin2 = 5;
const int ledPin1 = 8;
const int ledPin2 = 9;


boolean ledState1 = true;
boolean ledState2 = true;


boolean lastButtonState1 = false;
boolean lastButtonState2 = false;


unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;


void setup()
{
  pinMode(buttonPin1, INPUT);
  pinMode(ledPin1, OUTPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(ledPin2, OUTPUT);
}


void loop()
{
  unsigned long currentMillis = millis();


  // Read button states
  boolean reading1 = digitalRead(buttonPin1) == HIGH;
  boolean reading2 = digitalRead(buttonPin2) == HIGH;


  if (reading1 != lastButtonState1 && currentMillis - lastDebounceTime > debounceDelay)
  {
    lastDebounceTime = currentMillis;
    lastButtonState1 = reading1;


    if (reading1)
    {
      ledState1 = !ledState1;
      digitalWrite(ledPin1, ledState1?HIGH:LOW);
    }
  }


  if (reading2 != lastButtonState2 && currentMillis - lastDebounceTime > debounceDelay)
  {
    lastDebounceTime = currentMillis;
    lastButtonState2 = reading2;


    if (reading2)
    {
      ledState2 = !ledState2;
      digitalWrite(ledPin2, ledState2?HIGH:LOW);
    }
  }
}

(deleted)