To legalize some activity is to change a law so that people are free to do it. You might live in a state that once banned fireworks, until citizens voted to legalize them—making Independence Day significantly noisier.
When something that's been illegal goes through the process of becoming legal, the government legalizes it. Gambling was legalized in Nevada back in the 1930s. To legalize a person is to make them a legal citizen of a country. Today, many people argue for legalizing victimless crimes, or those that arguably don't hurt anyone.