Establish BLE connection with phone and nano esp32

OK, then you should use the "ArduinoBLE" library:

Install that library via the Arduino IDE Library Manager.

Note that this library has a different API from the ESP32-specific "ESP32 BLE Arduino" library used by @andre_alm10 so you won't be able to use the sketch code they shared verbatim. In addition to the reference I linked above, a collection of example sketches are provided with the "ArduinoBLE" library. You will find them listed under the File > Examples > ArduinoBLE menu in Arduino IDE. You can study them to learn how to use the library.