Not sure what your question would have to do with one of the Apple routers shown below that we support in this forum.....the AirPort Express, AirPort Extreme, and AirPort Time Capsule. Are you using one of these routers?
If not, you may receive a much faster and more informed answer if you post your question in the support forum for your iMac. The link is just below.
iMac
In the meantime, you might want to try the following on your iMac:
Open System Preferences (gear icon on the dock)
Open Network
Click on WiFi on the left panel to highlight it
Click Advanced at the lower right of the window
Here you will see a list of networks to which your iMac has connected in the past
Click on the name of a network to highlight it, then click the - (minus) button at the bottom of the list to delete the connection
Do the same for every other network, so that the box is blank when you are done
Click OK at the lower right of the window
On the next window that appears, click Apply
Close the windows and restart the iMac
Try to log onto your network again to see if the new settings will hold. You will have to enter the password to connect the first time that you connect.