One of the fastest ways to get in an argument on the internet is to talk about alignment. A lot of people have very strong opinions on the subject, and if you're playing in a game with those people - especially if they're the GM - it can be good to ask for their guidelines for how each of the alignments work. Just remember that guidelines are exactly that, they are guidelines. In fact, with that in mind, let's get into it.
As a disclaimer, for ease and breadth of use the alignment system I am going to talk about most here is the classic D&D Lawful Good -> Chaotic Evil alignment matrix. This is not only the system used by two of the largest games (D&D and Pathfinder) but also the one most found in memes. It also gives us a system to talk about alignment as a whole and what it means.
What Alignment Is
Alignment is a system to give a general role playing clue as to how the character will general act. Dungeons and Dragons is a game about Good vs. Evil, and so alignment gives us a way to flag where a character falls in that fight. The thing is, it is not a clearly absolute system. It is also poorly explained in several editions with a lot of wiggling around "ask your GM." Which while great advice, doesn't work if you're the new GM trying to run your first game.
In short though, alignment is one of several pieces that tells us how a character can be expected to play. If you tell a group you want all the characters to be 'Lawful Good' that describes a type of action sets you would like characters to fall in. When you tell someone you are playing a 'Chaotic Good' rogue it sets expectations.
Ultimately though, Alignment is a guideline. Though some old school variants of games do have certain classes or abilities key off of alignment. So that guideline is more important to some characters than others.
What Alignment Is NOT
The big thing here is that Alignment is not a set of railings, box, bumpers, chains, or other type of binding and confining box that tells you how you have to play or act in a situation. Alignment reflects how a character acts, it does not confine them to that type of action. As a character grows and acts their alignment may change. That change may have consequences (especially for characters with items/abilities bound off of it.) But beyond those, a change of alignment isn't a punishment so much as it is book keeping to make sure the stats on the sheet reflect the current version of the character. Just like if you somehow gained a proficiency that would be added to the sheet too.
Put another way, there is no rule that says a Lawful Good character can't murder you in cold blood. However, it would be very surprising and unlikely for a lawful good character to do that. And if said Lawful Good character did not feel guilt, atone, or otherwise reconcile the action they could very quickly find themselves no longer being a Lawful Good character. But even if the act itself changes the alignment that does not mean the character can't do it. It just means that acting in that way is, in some way, a big change for the character.
How Does Alignment Work?
While specific systems have their specific ways, the classic D&D style alignment system works on a matrix. One axis is a spectrum from Lawful through Neutral over to Chaotic. The second axis is a spectrum from Good through Neutral over to Evil.
This is where the arguments start by the way. After all what is "Good"? What is "Evil"? These are concepts that exist. In fact, in your average D&D world not only do they exist as concepts but as factions. Much of High Fantasy is about actual Good (capital G) versus actual Evil (capital E.) However, that gets harder to work when you pin it down onto characters.
I can't give you definitive answers, but I can give you my take.
Lawful vs. Chaotic - a.k.a. Who Are The Rules For?
A lawful character believes and lives by a set of rules. These could be the laws of the land, or they could be a personal code of honor. Some of the best villains out there are Lawful villains, and the reason they work is because their structure, their code, adds a gravitas not there in the person embracing chaos at every turn and just doing as they please.
However, this does not mean that a Chaotic person is against rules. It just means that a Chaotic person doesn't believe the rules apply to them. Red Dragons are both Chaotic Evil and described as "Tyrannical Dictators." Tyrants are known for having strict rules and laws, but the tyrant themselves are above those laws.
With this in mind, you can generally tell if a character is Lawful or Chaotic based on who they think the rules apply to. A Lawful character will work within the rules (even if just the rules of their personal code.) A Lawful Good character is more likely to go by the spirit of the rules, while a Lawful Evil character may go by the letter of the law, but that is not necessarily the case. A Chaotic character on the other hand lives outside the laws. Either they justify or excuse their rule breaking (which is done frequently) or they truly believe they are above the rules, and the rules do not - or should not, apply to them.
Good vs. Evil - a.k.a. Do You Care About Other People?
Good and Evil are big forces, but the simplest way I've found to explain the difference between Good and Evil on the D&D alignment chart is Altruism vs. Selfishness, or just flat out 'how much do you care about other people?'
The word people here is specific. An Evil Character can care about people around them, but those people aren't just "people" they are specific individuals. Even then, an Evil character is primarily concerned about themselves and their goals. They could be deluding themselves with justifications - it is in the best interest of all if I do XYZ - but ultimately it still comes down to be all about them.
A good character thinks of the other people. They consider the consequences of their actions on others. They act to try and help others out. That doesn't mean they don't also look out for themselves - you have to make a living - but they are also trying to help someone. This is someone becoming a Doctor looking to cure a disease and save countless lives, as opposed to someone looking to become a Doctor in order to be wealthy, respected, and hopefully famous with the power of people's lives or deaths in their hands.
An Evil character, as I said, does not care about other people, or at least is very willing to sacrifice those people towards what they deem the greater good. They do not consider the consequences or ramifications of their actions. They are looking out for number 1, and only for number 1.
What About Neutral?
Both Lawful/Chaotic and Good/Evil are axis in the matrix. They are a spectrum and a character can fall anywhere on that spectrum. Neutral is the defining term for the middle area of both axis. They do not hold strongly to a code, or to them being above codes. They are neither defined by their consideration for the people around them, or all about themselves. This does no mean they don't have those proclivities, but where those proclivities lie can change from topic to topic as opposed to a more general standpoint.
The Key: Remember It Is A Spectrum
Most arguments about alignments happen because people think that alignment is a narrowly defined band of things, when in actuality it is a spectrum. Draw a graph and overlay 9 boxes on top of it. Those are the alignments. It is possible for a "Lawful Good" character to be on the extreme furthest corner from both the Chaotic and Evil sides of the graph, or they could be almost in Neutral on Law/Chaos and at an extreme on the Good/Evil. Alternatively, they could be just about to slide into Neutral on box fronts.
There are countless ways to play each alignment while holding to the broad strokes meaning of those alignments. Which is why I hold to broader definitions regarding 'who do you think the rules apply to?' and 'do you care about other people?'