Wireless problems on iMac
Try changing the channel of your WiFi router. Might fix confusion of the AirPort. To do, see the documentation for your router, for suggestions as to which channel you should choose, option-click the wifi button in the status bar, click Wireless Diagnostics, and then after the application opens, click window, and Scan. This will tell you the best channel to choose for your router.


If changing the channel doesn't fix the issue, try running the Apple Diagnostics Tool. 

OR

If your iMac is pre-2013, try the Apple Hardware Test after completing the steps above with the exception of the Diagnostics tool.