By PolskiBus bus it takes 9:30 hours and costs 15-26 EUR (62-109 PLN), depending if you buy in advance. It leaves ~3 times a day, isn't very comfortable.
Direct Euro InterCity train takes around 5 hours and costs around 54 EUR (230 PLN) for second class, around twice as much as the bus. If you buy in advance it can be cheaper, even 39 EUR as Martin mentioned. You can check the routes and pricesbuy the tickets on Polish railways website or German railways websites.
You can also go by BlaBlaCar, it should take 6-7 hours.