All celebrities are famous people, but not all famous people are celebrities.
The word "celebrity" is derived from celebrate, meaning a person that is celebrated. They are followed by news reporters, you see them in television, they have fans.
Someone is famous because they are well known within a particular community for some achievement. For example, within the medical community Dr. James (not a real person I am just making this up) is famous for inventing a medical device. He is not a celebrity since, other than a possible news article about the device, no one is regularly following him, he has no fans and is not continually in the news.
We sometimes call friends and acquaintances celebrities as a term of affection or encouragement, even though everyone knows they are not celebrities.