The Bavarians, who kick off their Bundesliga season on Friday against Hertha Berlin, should have scored several more after twice hitting the woodwork in the first half and missing plenty of other chances.
Bayern, who had progressed in each of the last 30 German Cup away games before Monday, went ahead when Poland striker Lewandowski volleyed in from close range on the rebound after Coman's header was blocked in the 32nd minute.
With Cottbus largely boxed into their own half it was only a matter of time before Bayern scored again and Coman, who had hit the crossbar late in the first half, made amends in the 65th, shaking off his marker and firing in a low shot from 18 metres.
Substitute Goretzka sealed their victory with an 85th minute strike before a stoppage-time penalty from Berkan Taz gave the hosts a consolation goal.
VfL Wolfsburg had a much harder time, needing 120 minutes to beat Hallescher FC 5-3 after the third-tier club levelled to make it 3-3 in second half stoppage time.
Borussia Dortmund beat KFC Uerdingen 2-0 on Friday to book their second-round spot but there were some Bundesliga casualties with Mainz 05 and Augsburg crashing out to lower-ranked teams on Saturday.