Internet of Things Stack Exchange is a question and answer site for builders and users of networked sensors and control devices in the contexts of smart homes, industry automation, or environmental sensors. It only takes a minute to sign up.
All smart plugs generally have same method of connecting to Wi-Fi and with the mobile application.
Check the Wi-Fi light on device
Search for device's Wi-Fi broadcast and connect
Add home Wi-Fi SSID/password in the app
Control the device with app.
So do the device is actually connected with app initially ?
Whats happening while we select the device Wi-Fi broadcast ?
And How the device got the Wi-Fi info (that we entered in app) is available to app?
So between step 2 and 3 device is not connected to home Wi-Fi. So the app sends the Wi-Fi info to device? What protocol is used for that?
There is no specific protocol. It's all Wi-Fi. Your smartphone connects to a temporary access point of the smart plug which is set up after you press the button. After transmitting the credentials of your home Wi-Fi via the temporary access point Wi-Fi the smart plug connects to your home Wi-Fi and you switch your smart device back as well.
That is the OSI layer story up to layer 4. What happens above that layer might be smart plug specific but it's likely a single message transmitting your home Wi-Fi credentials (hopefully encrypted). I would not consider such single messages a protocol.
This is speculation, so any comments to improve this answer will be appreciated.
Likely most IOT devices expect you to download their App into a modern smart phone. That the App temporarily turns the smart phone into a wifi hot-spot with a specific SSID which will accept a connection from the IOT device. Configuration data for the wifi network normally used it sent. The phone returns to the normal wifi network as does the IOT device.