I have a Swiss and German passport and want to travel to the U.S. but only with my Swiss passport. Do I need to declare the German nationality in the ESTA application? And if so, would I need to take the German passport with me to the U.S.?
Nope. You use the one you intend to travel with/as.
Eg, I have dual NZ and South African citizenship. The South African passport is awful to travel on, and I can get ESTA for the US. So I apply for the ESTA, and travel, using my NZ passport. I've done this regularly.
If you have dual citizenship and have registered with ESTA, you should use your VWP-eligible passport to board the plane when you leave your country of departure and when you arrive in the U.S. If both your countries of citizenship are VWP-eligible, then we strongly recommend you choose which one you want to claim for purposes of travel to the U.S., and use that country's passport each time you travel. One person with two different ESTA authorizations creates confusion that will only delay your travel.