What CPU would be the best bang for your buck on a 400$ gaming PC?

I want to know what CPU is the best bang for my buck for my gaming PC build
in 2017. I want to see what processor would give the best performance and I'm planning to use a Sapphire RX 460 NITRO. I chose a AMD Athlon X4 845 but if there's a better option out there please let me know.

Let's see what AMD offers in Ryzen.
Your $400 should not include Windows, especially in retail at $85
There are better choices than the Sapphire RX 460 Nitro around.
I would not use AMD CPUs until independent game testing with Ryzen is available.
What games do you have in mind? Passmark score is not a gaming measure.
The 845 should be close to an 860K:
http://www.techspot.com/review/1180-overwatch-benchmarks/page5.html
http://www.techspot.com/review/1271-titanfall-2-pc-benchmarks/page3.html
Feel free to find more.
Given the lack of cpu upgrade in the FM2+, and the cpu is already bottlenecking an RX 460, I don't know why you are specific about brand of rx 460 when the cpu puts its performance to half the reported gaming anyway.

Unless you can bring your price point up, or wait a while, today's bargain starts with a used PC, 2nd or 3rd gen quad core i5.
If going for a full ATX width, you choose to swap out the old power supply, and would need to with the Sapphire, but a $100 RX 460 and maybe a cloning to SSD or new computer case, you can work within budget easily with Windows operating system included and legal.

Used quad core i5 go for $210 to $300 at Newegg.com, and may be found in other stores.
Sneak in a low power RX 460 for under $100 and clear a whole system for under $400.
About $400 without Windows or optical drive and the CPU is not upgradable and is disappointing in gaming.
https://pcpartpicker.com/list/zj4CgL

$232:
https://www.newegg.com/...6883797950
Lenovo Desktop Computer M91P Intel Core i5 2nd Gen 2400 (3.10 GHz) 8 GB 1 TB HDD Windows 10 Pro 64-Bit
should be 7052-B5U
Non-gaming:
Core i5-2400 @ 3.10GHz5862
Athlon X4 8455488
But gaming, an i5-2400 is pretty good
Intel 82579 Gigabit Ethernet LAN, one PCI Express x16 slot, PCIe x1 and two PCI slots
only a 280 watts with variable speed fan, autosensing, 85% PSU
Should accept a 75W maximum graphics card with no 6 pin.

There are other choices, but this is an economy way to get high gaming performance with a low budget.

https://pcpartpicker.com/list/rRZLf8

The newly released Intel Pentium G4560 is the Newly Crowned budget King. It just came out a couple weeks ago. This is the first Pentium CPU with Hyperthreading. It's supposed to be $65 but it's out of stock at a lot of sites. Probably needs more time to become available.

I'd pair this with a socket 1151 B250 board for a killer budget gaming PC with good performance.

If you can, wait for AMD to release Ryzen. That should shake the market up and cause a few price cuts.