Capitalism and socialism are similar in only one broad respect: the idea that every person is compensated according to his efforts. The phrase "from each according to his ability, to each according to his needs," is the ideal of communism, which is the ultimate form of socialism but not reality.
In both capitalism and socialism, the means of production and the products are owned by entities. In the case of capitalism, property and assets are privately owned. In socialism, private property can exist and people own their own businesses, but the government exerts more authority and creates social nets to help the poor, also preventing businesses from taking in too much profit.
Capitalism is more about competition, whereas socialism is about cooperation, with entities cooperating for the good of all. Communism, meanwhile, is an ideal of socialism in which there is no privately owned property, aside from the fruits of a person's labor. For example, someone could make a shirt but not own the factory used to make it.
Capitalism and socialism exist on a continuum; there is no such thing as pure capitalism or pure socialism. For example, the United States, which has a capitalist economy, has social networks such as Social Security, SNAP and Medicare. Socialist countries like China allow workers to keep their funds.