I'm going ASSUME your 2011 iMac has Thunderbolt. That's when Apple started rolling it out, and it makes life a lot easier. From what I can find, all 2011s did.
The way I would do it is first get one of these
https://www.apple.com/shop/product/MMEL2AM/A/thunderbolt-3-usb-c-to-thunderbolt-2-adapter
And a USB C cable.
Connect the adapter to the Thunderbolt port on the back of your 2011 iMac(it's the D shaped connector with a lighting bolt symbol next to it) and the USB-C cable from the adapter to one of the USB-C ports on the new 2011 iMac.
Boot the 2011 iMac in Target Disk Mode by holding "T" while powering it on. It should power up to a gray screen with the thunderbolt symbol(a lighting bolt) bouncing around. At the same time, it should appear as an external volume on your 2017 iMac.
Launch "Migration Assistant" on your new Mac, follow the prompts, and let it go.
Thunderbolt is fast, and the transfer speed is probably limited by the speed of the drives in the two computers. Depending on how much data you're moving, it may take a few minutes, or it may take overnight.
Regardless, once done, your new iMac should be just like using your old one. All of your user accounts, passwords, etc will be the same. Your dock should be the same, and programs and files will be right where you left them. It really is as seamless as you could ever ask on a new computer.