With what hardware setup / development board, with what code, platformio.ini?
Brownout is when the microcontroller detects that the 3.3V power supply line is breaking down. How do you power your board? Do you have something attached to it that draws lots of power?
Then it is very likely a hardware issue with your board. Activating the WiFi and joining a network powers on the WiFi radio, which has a high current spike at the beginning. If the bypass capacitance on the power supply is too low or the max peak current of the power regulator is too low, then the 3.3V collapses, causing a brownout. I would suggest to try a 100-470 µF capacitor between 3.3V and GND, or try to deactivate the brownout detection as the first thing in setup() (or app_main when using esp-idf) using