AirPods connect to correct device
Under the Listen with your AirPods section of this Apple support document:

Follow these steps to use your AirPods to play audio from a different
device or to switch the audio to different headphones or speakers.
On your iOS device
Open Control Center. Press deeply or touch and hold
the audio card in the upper-right corner of Control Center to control
audio. Tap the airplay icon, then choose the device you want from the list.*
On your Mac
Click the sound icon in the menu bar and choose your AirPods* or other speakers
under Output Device.
*AirPods appear only when they're nearby and ready to use.