The government mandates (official decree, passing a law, whatever) that Company X now belongs to the Government. Prior owners/stockholders of X may or may not be compensated, depending on what the Government decides.
Nationalizing a company has a chilling effect on international corporate investment. If companies are routinely seized if they make too much money or print something the government doesn’t like, then investors will take their money someplace else where this doesn’t happen, like the EU/US
Latest Answers