TL;DR it's basically a utopian vision and as the ideas developed long before the application basically anybody could and did add their own two cents.
Speaking from a Euro-centric perspective, the 19th century was a time of massive change. The "old regime" with its "god given social hierarchy" consisting of the 3 estates (peasantry, nobility and clergy) had taken major damage. Ideologically the enlightenment questioned it's religious foundation, economically the upcoming mercantilism and capitalism questioned it's economic supremacy and politically the middle class demanded participation. Initially often in the form of reforms and amending the status quo with a constitution but as these were often suppressed and kept down, leading to more radical steps like the revolutions in America and France. Which weren't able to settle for a constitutional monarchy and so went straight for a republic without monarch. All while the industrial revolution was coming up, providing unseen opportunities on one end and grim working conditions on the other.
So it was a time of massive change with lots of hopes and fears about what the future was about to bring forth. Like on the one end of the spectrum you had conservatives with existential dread cause of the crumbling of their system, who wanted to turn back the time and go back to the "god given hierarchies" and for whom all of that was "a fall from grace" or something like that. While on the other end of the spectrum you had people with high hopes that now EVERYTHING is possible. Like seriously the political spectrum ranged from literally absolute monarchism (pure tyranny) to full fledged anarchism and I don't mean that Anarcho-Capitalist bullshit, but REAL Anarchism. Like "no god, no state, no slaves, no masters". Like rejecting all authority, law, hierarchies, morals unless it originates from the free and equal association of the people themselves, with no leaders, authorities, institutions and no social, political, economical or any other sort of hierarchy that would have some people rule over the rest. So self-government without rulers.
Now while "liberalism" would in its idealism and slogans reflect the latter, with their hopes and dreams of universal freedom and equality, no more cast systems, people being only constraint by nature and the freedom of other people. Stuff like "We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness" or the "Liberté, Egalité, Fraternité" of the French Revolution really driving home the point that of democracy being government by the people for the people, through the people. The state being property of the people (republic) not the king (monarchy) and resting upon a social contract rather than some folklore or religious mysticism, all rights being crafted by the people based on consent and agreement.
However when they finally took power the result was not without a major anticipointment. Rather than the end of all caste systems and universal freedom and equality or even a direct democracy, people got a representative democracy where often enough voting rights were tied to income and so it was more of a "meet the new boss, same as the old boss". Which lead to the "classical liberals" moving from the far left progressive side of the spectrum to the rather right wing side where the conservatives welcomed them, because while the original conservatives were executed or had to realize the futility of their goal (or had to wait for the barbarian resurgence of their ideas with fascism) at least the capitalism of the liberals largely preserved their traditional power structures, just with a different narrative. Now the aristocracy is no longer the ruling class because they have historically proven to be the best (or at least paid someone to forge such accounts) and been a descendant of those, but because they own large portions of land and are still filthy rich. Sure the circle with who they have to share power widened and the industrial factory owners will soon exceed them in wealth, but so far lots of stuff is remaining the same so the conservatives often made their peace with the liberals as long as they'd betrayed their ideals or see them as fulfilled with the "progress" that they made and aren't going further with that pace.
So now the last of the 3 major ideologies coming out of that post-enlightenment mess, is: Socialism. And the reason why it's so lousily defined is because it basically includes the entire rest of the spectrum that is not satisfied with how things are. And that includes a whole spectrum of ideologies of its own. Like you have anarchists and authoritarians, reformists and revolutionaries, militants and pacifists, unionists, political parties, individualists, collectivists and a whole lot else. Their smallest common denominator is basically that with the political progress they see the largest roadblock to equality and freedom as universal rights within the unequal distribution of the means of production and the massive social and political power that is generated out of the economic inequality and so their proposed solution is that these crucial assets of society that give power over other people should not be privately owned for the profit of the owner alone.
The the basic idea for socialism is a society of free and equal people who share the ownership of the means of production and in which members produce according to their ability and receive according to their needs with a direct political mandate of the individual to decide that.
Now that's obviously utopian, not in the sense that this would be impossible, but in the sense that this isn't realized anywhere yet and so basically any and all models of society that roughly matches those constraints could call itself socialist/communist (at the time and depending on the language these two used to be used largely synonymous) and so even at the time when Marx himself was around there had already been hundreds of definitions of socialism/communism. Just read the intro to the communist manifesto:
A spectre is haunting Europe – the spectre of communism. All the powers of old Europe have entered into a holy alliance to exorcise this spectre: Pope and Tsar, Metternich and Guizot,French Radicals and German police-spies.
Where is the party in opposition that has not been decried as communistic by its opponents in power? Where is the opposition that has not hurled back the branding reproach of communism, against the more advanced opposition parties, as well as against its reactionary adversaries?
Two things result from this fact:
I. Communism is already acknowledged by all European powers to be itself a
II. It is high time that Communists should openly, in the face of the whole world,
publish their views, their aims, their tendencies, and meet this nursery tale of the
Spectre of Communism with a manifesto of the party itself.
To this end, Communists of various nationalities have assembled in London and sketched the
following manifesto, to be published in the English, French, German, Italian, Flemish and Danish
Or in other words everybody knows something is about to happen and every progressive either calls itself socialist/communist or even if they don't are called that way by conservatives to defame them and because no one has a plan of what that actually means "we" are going to define our goals here.
Now after the first socialist revolution of the Paris Commune in 1871, was kinda underwhelming in terms of the organization and the fact that it was brutally gunned down (to be fair a republic within a city, within a war was ambitious to begin with, though made the revolution part easier, we'll come to that one later). Marx proceeded to bully out the anarchists from the first international (workingmen association) and was really kind of a bitch towards anything utopian. Like he studied economic science and tried to give socialism not just a utopian but also a scientific foundation, at least that's what he called it and let's be fair for the time the standards of science weren't all that high.
Also apparently "the state" was no longer seen as the problem, like the anarchists would see it, but as some means to exercise power that would "wither away" once it served it's purpose as Marx apparently anticipated some time of turmoil after a revolution before things would fall into place.
Then Marx died and in Russia communists were having a meeting in which Lenin got a slight majority for his plan to form a revolutionary vanguard party to make the revolution, it's apparently the only time he ever got a majority for his plan in a free election. He nevertheless kept the term for majority as his party name (Bolshevik). However he was largely ineffective got himself imprisoned and missed the revolution of 1905 and 1917. The first established a parliament but that got stuff with czarist cronies so that the progress was largely rolled back. However it featured an interesting concept that would be relevant later namely "soviets". That is councils of workers and soldiers that would on the ground organize the revolution in a direct local democracy. So when in a perfect storm lots of people protested in Saint Petersburg in February of 1917 the czar resigned and the revolution spread across the country. Now Russia was still amid fights of WWI and was starving, so the provisional government that continued the war was soon as unpopular as the czar while the soviets and their congress of soviets became an alternative government leading to the "dual reign", one government with officially backing but little public support and another with a democratic mandate but not officially recognized as such.
Now according to Marx the revolution was about to happen as a result of the most industrialized countries driving social and economic inequality to such extremes that there were only 2 classes with no middle ground and than they would clash. Which wasn't really the case in Russia, which had barely started industrializing and was largely peasant and didn't even have a successful liberal revolution.
So people were contemplating what to do next when Lenin came back from exile in Switzerland with the help of the Germans who hoped he would create trouble and make Russia lose the war and he did. He ran on open doors and agitated against everyone the provisional government the soviets and before the soviets could meet and decide what to do next he attacked the provisional government and seized power. Then he made elections, lost to more left leaning parties and dropped the concept of elections as not successful.
He then fought a several years lasting civil war and then rolled out an economic program which promoted capitalism in an attempt to do social democracy to make Russia ready for the next step. All while calling his reign socialism, because that was kinda popular at the time.
Now similar to the liberals who didn't really follow through with their ideals. That was largely not what people expected socialism to be and so Stalin apparently argued that this "intermediate state of turmoil" that Marx talked about should from now on be called socialism and that this is where they are because obviously it wasn't the stateless classless utopia that communism was supposed to be. Also it wasn't really soviets anymore either as it was transformed more towards a top down government whereas soviets where decidedly bottom up. And really that state was just a temporary solution that would "wither away".
So both the "Soviet Union" and it's adversaries called it socialist because the soviet union thought socialism is cool and popular and the adversaries to defame the very concept, at the time America actually had some union and anarchist action going on and if peasants in Russia can topple a government a lot of capitalists and governments around the globe got something to worry about.
Meanwhile not all socialists were too fond of the soviet union. First of all it also murdered it's leftists as "counterrevolutionaries" and basically rolled back most of the progress that was being made moving to first liberal capitalism and under Stalin to some state capitalism where the state serves as one giant company. So that the term "real existing socialism" was used by proponents and critics of Soviet Union to denote that it was not what was expected.
Then WWII and capitalists were once again afraid of socialism, also the USSR had become quite imperialist. And so again anybody and everybody that wasn't in line with the status quo was a filthy socialist. Muddying the already muddy water. Tons of socialists were not to fond of the USSR but as it's the main representation in the world that is using that label their image is what sticks for many people and capitalists are pretty glad to be able to point to a failing example to argue "see that's what you get if you demand fair wages and participation".
So if there hadn't already been a lot of confusion about socialism means the cold war propaganda alone would have created it. So essentially socialism can mean anything from a vague ideal of a society with universal freedom and equality to some Marxist-Leninist (Stalinist) approach of an authoritarian government that tries to industrialize itself to the point where they can transition or... you know never transition and be neo-conservatives with under a red banner. You know the party is still a hierarchy and maximizing their profits and power is precisely what a king would have done as well. Same story yet another narrative to legitimate it.