Why do pilots do walkaround inspections for regularly scheduled commercial flights instead of aircraft mechanics?
Because it's the Captain's plane, for all intents and purposes. This is exactly the same for many other industries - in particularly shipping (as in boats) and haulage (as in trucks).
Similar to planes, ships and boats have captains and they are all fundamentally and legally responsible for everything that happens on that mission. And, likewise, a truck driver is expected to maintain responsibility for their truck - indeed, over here in the UK this is a legal requirement and truck drivers have to do a mandatory walk-around check.
It's also the same for car drivers - you, as a driver, are fundamentally responsible for your car and its safety.
Focussing on aircraft, the pilots probably have the single most holistic view of the aircraft, its mission and the requirements. In addition, the pilot is always going to be there - whether that's Heathrow at 2pm on a Tuesday, or a deserted dirt strip in the outback at 10pm.
The better question might be - what good reason would there be to skip a walk around in one of the most safety-critical industries? At best, for some airports in some circumstances, you can argue somebody else might be able to conduct the walkaround - but it's not guaranteed and it introduces another potential point of failure or miscommunication.