Thoreau is saying that practical knowledge is more useful than academic study. He makes this claim by playing on two different meanings of bread and mechanics.
First, he is using bread in the senses of the staple food and of livelihood. From the Oxford English Dictionary:
b. Livelihood, means of living, subsistence. Now chiefly in to earn one's bread: to make a living, to earn income sufficient to live on.
Next, Thoreau contrasts the study of classical mechanics with a different sense of mechanics, viz. actual practical labor. From the OED entry for mechanics:
1. With singular or (occasionally) plural agreement: (a) the body of theoretical and practical knowledge concerned with the invention and construction of machines, the explanation of their operation, and the calculation of their efficiency; mechanical engineering; (b) the branch of applied mathematics that deals with the motion and equilibrium of bodies and the action of forces, and includes kinematics, dynamics, and statics. Now often distinguished as classical mechanics (as opposed to quantum mechanics).
†2. Manual labours or activities. Obsolete. rare.
The sole citation OED gives for this second meaning is from Gulliver's Travels:
1726 J. Swift Gulliver II. iv. x. 160 I shall not trouble the Reader with a particular Description of my own Mechanicks; let it suffice to say, that in six Weeks Time..I finished a sort of Indian Canoo.
This sense might seem too out-of-date for Walden, which was published in 1854, but further evidence comes from the OED entry for mechanic, which has the following definition:
1. Relating to or involving manual labour or skill, esp. in mechanic arts (see etymological note). Cf. MECHANICAL adj. 1. Now rare (chiefly historical).
Here are two citations from around the time of Walden:
1838 W. H. Prescott Hist. Reign Ferdinand & Isabella I. i. ii. 44 He was a considerable proficient in music, painting, and several mechanic arts.
1891 W. C. Smith Poet. Wks. 46 Pure good from mingled good and ill, From tokens of mechanic skill Illimitable glory and might.
The same OED entry also includes the following:
a. A manual trade or craft. Obsolete.
1656 tr. T. White Peripateticall Inst. 387 Consider the honour of..the Mechanicks, 't is the work that's most proper to mankind.
1692 J. Ray Wisdom of God (ed. 2) i. 195 Besides the known Uses [of plants]..in Building, in dying, in all Mechanicks there may be as many more not yet discover'd.
While Thoreau's using mechanics in the sense of manual labor would perhaps strike even a contemporary reader as somewhat archaic, the above citations, particularly those from 1838 and 1891, show that this sense would be readily accessible.
So according to Thoreau, sending a boy to a professor would mean that the boy learns chemistry, but not how to bake bread (which involves chemistry); and mechanics, but not any skill which would enable him to earn his bread (which involves manual labor).
"bread, n." OED Online, Oxford University Press, March 2023, https://www.oed.com/view/Entry/22888. Accessed 10 April 2023.
"mechanic, adj. and n." OED Online, Oxford University Press, March 2023, https://www.oed.com/view/Entry/115543. Accessed 10 April 2023.
"mechanics, n." OED Online, Oxford University Press, March 2023, https://www.oed.com/view/Entry/115556. Accessed 10 April 2023.