If the pope is infallible, than what significance does beatifying and canonising him have? They did both to John Paul II, but it seems odd that the church wants to make him a saint, unless I am misunderstanding the concept of saints.
First, Catholic teaching is not that the Pope is infallible in everything he says and does, but rather infallible only when specifically exercising the authority of his office to pronounce doctrine.
Second, a Saint in the sense meant by the Catholic church is one whose life, witness and actions have been examined in depth and at length by church leadership and has been found to be significantly exemplary of the Christian ideal. They are recognized by the Catholic church as examples to emulate, and are made "official", so to speak, so that there is no confusion among believers as to what constitutes a great example.
Also, as Patrick pointed out in the comments, other conditions and prerequisites apply; among them is the requirement that at least two miracles be directly attributable to the individual under consideration.
Therefore, a Pope is not automatically a Saint (with a capital 'S' since all believers are saints in the general sense); in fact, historically, many of them were decidedly unchristian in their actions and some downright wicked. Some very reputable Catholics have said that the preservation of the doctrine of the Catholic church in spite of some of her Popes is remarkable, if not nothing short of miraculous.
The infallibility of the Pope means that it is impossible for him (due to the guidance of the Holy Spirit) to lead the Church into wrong definitive teaching in regards to faith and morals. However, it does not guarantee that the Pope is a morally good person. It is possible for someone to teach the truth, but not live it himself. There are many examples of Popes who were not great examples in their moral lives, but there are no Popes who in their teaching promoted immorality or heresy.
When I say definitive teaching, I mean teaching where the Pope defines a certain teaching as part of the Christian faith to be believed by all Christians. This does not include teaching on certain practices that are deemed prudent for a particular time and place. It also does not mean that every explanation of a Pope is 100% without error.
The Church beatifies and canonizes those Popes who lived extraordinarily exemplary Christian lives, and so far it is less than half of them. (Out of 266 Popes, I count 79 that are Saints.)