Newbie Question about using "void setup()"

Why is the debounce function in void setup()

It is not. There are only two statements in the setup function. The function definition is surrounded by { and }

The debounce function is called from the loop function in this line:-

currentButton = debounce(lastButton);

The code:-

boolean debounce(boolean last)
{
  boolean current = digitalRead(BUTTON);
  if (last != current)
  {
    delay(5);
    current = digitalRead(BUTTON);
   
  return current;
  }
}

Is a new function your code has defined, it's name is debounce