Candy is lonely because he is devoid of any real human contact. He is kept as a cleaner on the ranch on the account of losing his hand in a machinery accident. He does not have any real human connection with anyone on the ranch, as most ranch-hands are more focused on their own job, making their bit, and not on him. Candy's only real companion is an old sheep dog. Like Candy, the dog is well past his prime, but used to be useful. The dog and Candy are the only companions for one another. His being on the ranch as one without promise or possibility for advancement only accentuates Candy's lonely condition.
When Carlson puts down Candy's dog, Candy's loneliness magnifies. It is out of this that he chances into the plans of George and Lennie and financially commits himself. Upon seeing Curley's wife's dead body, it becomes clear that his dreams are gone and his loneliness is underscored even more. Candy's loneliness is present because he lives in a world without dreams or hope and without companionship to help make life worth living.