Apple did something strange with their iMacs between 2009 and 2011, they added a thermometer to the hard drive so if the drive overheated, the fans would run at maximum speed to cool the hard drive. Perhaps they found the hard drives would seize up when they got too hot. The later iMacs don’t feature this.
Insane fan speeds on replacing the drive
On the 2009 iMac, the thermometer was attached with a glue pad and was easy to transfer to the new drive, or failing that, the two wires could be stripped and twisted together.
On the 2010 and 2011 iMacs, built into the drives used by Apple is a thermometer. If the drive is replaced with a non-Apple drive or an SSD, there is no thermometer so the iMac believes the hard drive is on fire and the fans spin at maximum speed. Often software is installed that shuts down the fans, but that means from the point of switching on the machine to the point the operating system is loaded, the fans make so much noise.
Workarounds
There exists two fairly simple workarounds, one is actually used by Apple when they install SSDs in these iMacs, the J4511 short method, which involves a connector that fits in the socket and shorts the thermometer pin to ground, which prevents the fans from thinking the drive is on fire. If you don’t have the connector, you can short the pins on the logic board directly with a bit of clever soldering.
The second method is to short out two pins on the drive. Pin 11 and Pin 12 can be shorted together (the pins aren’t used on the drive, but that does the same action. If someone changed the drive in the future, the fan noise will return.