Lewandowski is indeed a very good player and he's also good at scoring, however I think the reason why the club choose to sell him is for them to get some funds since he's one of the best players in barcelona so any club that want him we have to pay a big amount of money. Moreover I think his contract has expired maybe the club didn't have enough money to renew his contract so instead of going for a free transfer they should sell him and add the money in thier funds or better still they can sign a new replacement. I feel like barcelona don't have enough money to be signing new players, except they would have to sell one quality player to be able to add up with the little they have.
Sometimes as a club you need to let go of some players based on their contract ending and the age. Lewandowski is a very wonderful players but considering his age, it is much better they sell him. The reason why because, Barcelona wants to build a team of young players that will become a start in the future. Check the squad, they are getting rid of some aged players just like how Real Madrid is doing. This does not mean that Lewandowski is not fit to be in the squad. We all know he is much experienced and better than most of the Barca players.