You have posted your question in the High Sierra community but your profile says 10.11 which is El Capitan.
Did you check that your new mouse can operate in Mac OS X El Capitan.
If you bought a Magic Mouse 2 from Apple is your mac on the list of compatible devices.
Please read the compatibility section in this link,
Buy Magic Mouse 2 for Mac in Silver - Apple (UK)
The only iMacs with the 21.5 inch screen it supports are the retina models from 2015, 2017 and 2019.
If it is another mouse from another manufacturer then please read carefully the tech specs and compatibility
of your mac and its operating system with the mouse.