The term "legal" means anything that the law allows for, or anything that relates to law. For example, it is legal for people over the age of 21 to buy alcohol in America, because the law allows them to. People under the age of 21 are not allowed to buy alcohol by law, and therefore, doing so is illegal.
Legal simply describes things that are not punishable by law. For example, it is legal to drive one's car under the speed limit, it is legal to buy coffee at a coffee shop, it is legal to go for a walk in a park, etc. However, if one does something that is prohinited by law, then this would be illegal. For example, if one stole coffee from a coffe shop instead of buying it, then this would be illegal.