The Commodore 1540 disk drive, along with its better-known successor the 1541, is a computer in its own right, with its own 6502 CPU.
Why was it designed like that?
It adds significant cost to the drive, such that the drive ended up costing about as much as the computer to which it was connected.
It's not like no one thought of doing it any other way. The industry had seen the Apple II drives that just used the CPU in the computer.
It wasn't for performance gain. On the contrary, the Apple II got a lot more performance out of its drives!
One thing I can think of is that it may have been what allowed a serial cable to be the connection between computer and drive; maybe having the computer directly control the drive, requires multiple signals to be sent simultaneously, or reassembling the bits at the other end already requires some smarts in the drive? But even if so, surely a parallel cable would be cheaper than putting a whole (even if minimal) computer in the drive?
Another possibility is that they were thinking in terms of offering newer, higher capacity drives that the host machine would not know about? Which would be a reasonable thing to plan. In the end it did not work out, because copy protected games, but the engineers can be forgiven for not thinking of that.
Or was there some other reason I have not thought of?