Because he has reached a certain age, the boy learns what his job will be and he is sent to an old man who teaches him to feel emotions like happiness and also things like pain. Meanwhile his family, who, like the rest of the town, don't feel any emotions, have temporarily adopted a baby called Gabriel. At the end of the book he runs away with Gabriel to save Gabriel's life.
The book you are looking for is The Giver.
The story follows Jonas, a 12 year old boy living in a society that has engineered its people to have no emotion or memory of the community's past. There is always one person, The Receiver, who is the sole mind to hold the joys and pains of the past. Jonas discovers that he is to become the new Receiver and begins accepting the memories.
As his 'training' progresses, he and the old Receiver begin to come to the realization that the time has come for the community to have their memories back and devise a plot for Jonas to escape, which would return all his memories to the community. This plan is put into action when he discovers the baby his family is taking care is to be put to death because he is not developing "properly" to the community's standards.