There are direct bus connections from Cologne to Lisbon and Porto. It takes more or less 33 hours. A single ticket cost ~ 140 EUR. YOu can check schedules and prices via busradar.
It is also quite straightforward to do the journey by train. The fastest routes goes as follows. Travel from Cologne to Paris Nord. Take a metro to Paris Montparnasse and from there a TGV to Irun. In Irun you can board then the night train to Lisbon. If you want to go to Porto, get out at Coimbra and proceed from there to Porto. Prices depend on on the comfort, the date of travel and how long you book in advance. You can use loco2 to make a price simulation. Check separately for Cologne - Paris and Paris - Lisbon.
Other train routes are possible. The Man in Seat 61 has more details on this. They may be interesting if you want to stop somewhere en route.