depending on the make an model, but you need to ‘divorce’ the old ECU from the car its attached to ( you can’t just unplug and pass it on otherwise it can never be attached to another car) and the new (or new to you) ECU also needs to be matched to the car otherwise it won’t talk to the immobiliser, central locking etc. So although you may have acquired the ECU yourself its not just plug an play – the garage would have had to transfer the identity of the old ECU to the new one.
So the swapped ECU should have an identity that matches your car – digitally speaking. If a serial number is physically stamped on the case of the ECU thats a different issue
If you were doing this DIY you’d need to post your old ECU away and have the ID transferred to the new/refurb one otherwise the car wouldn’t recognise it. If you don’t do that you have to buy the ECU, ignition barrel and door locks from a donor car and swap them all in a oner.