In logic an argument is valid if and only if it takes a form that makes it impossible for the premises to be true and the conclusion nevertheless to be false.
Valid arguments must be clearly expressed by means of symbolic sentences called formulas.
The validity of an argument can be tested using the corresponding formulas: if some "interpretation" of the formal version of the argument produces true premises and false conclusion, then the argument is invalid and the interpretation provides a counter-example.
Thus, consider your argument: it has the following form:
All P are Q
s is P
Therefore s is Z.
You have provided an interpretation of the argument that replace the symbolic formulas with statements:
All men (P) are mortal (Q)
Socrates (s) is a man (P)
therefore, Socrates (s) can think (Z).
With this interpretation, the two premises are True and also the conclusion is.
But you have provided also another interpretation, where the conclusion is:
therefore, Socrates (s) is Swedish (Z).
In this case the conclusion is a False.
This is a counterexample showing that the argument form above is invalid.
If we consider the syllogistic structure of the argument, it violates the definition of syllogism:
an inferences with two premises, each of which is a categorical sentence, having exactly one term in common, and having as conclusion a categorical sentence the terms of which are just those two terms not shared by the premises. Aristotle calls the term shared by the premises the middle term and each of the other two terms in the premises an extreme.
In your example, the term Z ("think" and "Swedish") is not shared with any premise.
For more examples, you can see some introductory textbook, like e.g.:
Petr Smith, An Introduction to Formal Logic (Cambridge UP, 2020), Ch.2 Validity and soundness.