I can't really tell if you're serious...
Do you want to pan for gold in California or do you want to go backpacking for almost a year? You could probably get to Cali for much cheaper (counting a year's worth of backpacking expenses) if you hitched, or even bought a bus/train/plane ticket. It could also be a good deal faster (for a similar experience to hiking), if you took a bike.
In any case, I'll try to answer you seriously. If you're starting in St. Louis, then as was pointed out, the American Discovery Trail, which at that point is the Katy Trail, is where you'd probably be starting from. From St. Louis, it follows the Missouri River on a wide gravel trail that goes through plenty of towns. West of there and through Kansas, the ADT alternates between dirt roads, paved roads and bike trail. I have never been west of the Katy Trail's terminus and don't have direct knowledge of the type of terrain, but judging from the descriptions, it seems pretty much like you're going to be going across a lot of private property and through a lot of non-scenic cornfields, but I could be wrong. While camping is generally not a problem on the Katy Trail (even near towns you can just go down to the river), I don't know about the ADT when it's on actual paved or unpaved roads. Stealth camping is potentially possible anywhere, but do you really want to dodge into someone's cornfield every night while trucks rumble past you in the mornings? (I hope this is an exaggeration, and I admit I'm not fully informed.) Other possibilities would be state parks with their pay-campgrounds or motels in the towns. I don't know about the ADT, but most people who put in serious miles on the Katy Trail are bikers, who can cover much wider distances between camping spots and often choose to stay in towns.
I'll stop before I get to the Rockies because the possibilities open up much more at that point and I'm no specialist at east-west hikes through Colorado, Utah or Nevada, but it still seems like the best route from St. Louis to California would be by bus, at least until you clear the Great Plains. From St. Louis to the Pacific Ocean, if you follow the ADT, the route is 3290 miles long. I'm not trying to discourage you: that sounds like the trip of a lifetime! I'm just mentioning that depending on your physical condition and how cheap you are able to find food and lodgings, it could take you anywhere from 6-12 months and $1500-3000+ to do a hike which isn't going to be all that great to begin with through the first 1000 miles. And then when you get to California, it will be winter. Plus, you're doing all this to go gold panning, which wasn't exactly the most lucrative enterprise last time I checked. At the least I'd think you'd want to spend those months overcoming the learning curve because chances are you won't strike it rich, much less break even, right away.
In any case... that could indeed be a great backpacking trip, one that I've looked at doing before actually. But trying to make money panning for gold could also be a lot of fun if you knew where to go and the methods to use. I'm just looking at the whole thing from the point of view of my own one-track mind.