You call something a log because of what it is. A log is something you cut from a tree. If you cut down a large branch and then clean it up a little bit so that it is a nice straight piece of wood, then we call that a log. But it can't be too small. The smallest thing you would call a log is about the size of your forearm. So a log is a roughly cut piece of a tree which is not too small.
If you cut a log into a nice square piece of wood, then it is no longer a log. At that point we call it "lumber". We usually build houses out of lumber. You can also build a house out of logs, but then it would be a very rustic house, like a cabin by a lake. "Log homes" can be really beautiful.
You call something a beam because of what it does. A beam supports weight. It is a horizontal member in a building or a bridge (not a vertical member, like a column, or a post). A beam goes over an empty space. It has something to hold it up at either end but not in the middle.
You can use a "log" to make a beam, or you can use "lumber" to make a beam. You can also make a beam out of steel, or concrete, or stone, or plastic, or anything that is strong enough to hold up a weight.