Re-pair your phone's Bluetooth with the car.
Enable CarPlay/Android Auto on your head unit.
On your phone, turn on Wi-Fi and search for your head unit's hotspot (e.g., "Android-***").
Go back to the CarPlay/Android Auto interface. It should connect automatically!