Disclaimer: The "advice" given here will only be useful for rank beginners, and completing the campaigns doesn't get you past that level. There are some aspects of this that are just plain wrong for normal play, such as staying within the 40-population limit. Furthermore, the procedure described here can only beat the AI on certain maps - the small ones where you can contain it. If the AI can freely roam the map, gaining experience and resources, you won't have a chance. However, there are some aspects to this procedure that you will need to use and practice before you will be able to attempt to play against a real opponent.
OK, so you've been playing the campaigns, and they seem pretty easy, so you try a custom game (CG) against the AI, and you're happily going about your business, and then, within seconds, it seems, a humungous enemy army shows up in your base and wipes you out. So you curse a bit and start again, and the same thing happens, and it happens every time. Holy f*%#, you say, how is this possible?
OK, so you decide to build up static defenses as soon as possible, and it looks like you're surviving, but then HOLY F*%#, an even more humungous enemy army shows up WITH ARTILLERY, wipes out your Towers and your army and everything else, so you throw your computer through the window.
The bottom line, and it is important to understand this, is that the AI is very, very good at certain things. An expert Warcraft 3 player will have no difficulty beating the AI in a CG, but a beginner such as yourself will get pwned every single time. If you deviate even slightly from a perfect build order in the early game, say until population 40, you will be wiped out quickly every single time. The reason is that the AI will execute a perfect build every time without breaking a sweat. At the same time, it will very quickly produce a large army. Since the AI knows exactly what you have and where it is, it will be able to overrun you very quickly, and it WILL do so. Furthermore, the AI will wipe out neutral groups (creeps) very effectively, and this makes its army much more powerful. You can't do this, because you are desperately struggling to manage your economy, and you cannot possibly micromanage combats at the same time, and in W3, you absolutely must micromanage combat.
How do you cope? How do you improve? Because the problem is not that the AI is cheating (much), it's that you are DOING IT WRONG.
What you are going to do is learn from the AI. Play the game, and when you lose, look at the statistics. You will note that you always collected less gold than the AI unless you put all 5 of your initial workers on gold. So this question has been answered. A perfect build requires you to put all of your initial workers on gold.
It should be obvious that you should produce a lot more workers, and it seems reasonable to start harvesting wood immediately. However, this is wrong. In fact, your 6th and 7th workers should start building things immediately. (It is assumed that you are playing humans.) You can experiment with different sequences, but the sequence Barracks-Farm-Altar-Farm is the fastest way to get a small army comprised of a Hero and a few Footmen. This is the minimum force that can reasonably deal with a weak creep group. You need a Hero before you start engaging in combat, because your Hero needs to collect the experience from every fight. However, a low-level Hero alone is not very effective. (You could start this initial build sequence with your initial workers, and the AI does, but it isn't necessary, and it has some disadvantages, so it isn't recommended for humans.) Note that it is possible to use more than one worker on the same building, but that costs additional resources, and is not recommended. Produce 6 more workers, and put them all on wood. Build up as best you can. You will get overrun this time as well, but at least you will have resource parity with the AI at the end.
The next step is to determine a good build sequence that allows you to survive the early middle game. The combination of 5 miners, 6 lumberjacks, and 2 builders means that you will generally be gold-limited, and there is no way to increase your gold income without a second mine, which will not happen for a while. In order to not be food-limited at any point, your Farms need to be built before they are actually needed. Your first Barracks units are Footmen, but you only want a couple of them, because they are quite weak. You need a Blacksmith in order to build Riflemen, and you need a Keep in order to produce second-level units. You need a Mill before you can get Guard Towers. It is recommended that you get a Mill immediately after the initial build sequence until you are very good at micromanaging combat. If you get a Smith first in order to increase the size of your mobile army, you will still not be able to maintain parity with the AI, because it produces a horde of low-level units, and it passes the no-upkeep limit quite soon. This has disadvantages both in terms of gold income and total gold collected, so you don't want to try to do the same. In any case, the AI will always out-macro you, and it will always out-micro you. Therefore, you will always be playing catch-up.
Upgrade to Keep as soon as possible after your 13th worker arrives, but make sure that you have enough resources for continuous troop production. Your first, and perhaps only, Hero should be a Paladin because he can guarantee his own survival as well as keeping his troops alive. Take Holy Light first so that you can heal your troops in combat. Take Shield when the second group of creeps has been wiped out. Produce three Footmen in rapid sequence and then four Riflemen. You will need some Riflemen before attacking the second group of creeps.
All of this is very nice, but you will still be losing to the AI. In the next game, set the map visibility to fully visible. You will now know where the creeps are and how strong they are, and most importantly, where the enemy army is, and you will win this game. Have a written build order list available, and pause the game to check off tasks as they are completed and to think about the next one.
The units listed above need 13 + 5 + 3x2 + 4x3 = 36 food. You can only produce two Priests, which you will definitely need to heal your battered army when the second group of creeps has been wiped out, and then you are at the zero-upkeep limit. Don't get any more units! You should be able to hold the position for a long time with this force, although you will need a bunch of Towers. It is better to spend your gold on upgrades than on upkeep.
Let's assume that you are playing the Booty Bay map. This is an easy training map, because there is only one entrance to your territory, there is plenty of gold to give you all the things you need but not so much that the AI can keep attacking you indefinitely, and there are a couple of weak creep groups in your territory.
After killing the first creep group, pull two of the harvesters near your TC off wood (they have to walk quite far by now), send them to the front, and start building Towers past the peninsula with your second mine. Aim to get about 6 Guard Towers close together, and maybe add some Cannon Towers later. Build a Sanctum somewhat near the front. Your Towers alone should be able to hold out against the enemy attacks until artillery shows up. You need to smash the enemy artillery immediately when that happens.
As long as you can deal with the enemy artillery, you have pretty much won the game. Try not to lose any troops so that the AI Hero stays at a low level. Note that the AI is very good at keeping wounded troops alive. However, it does not take your diabolical nature into account, so you should be able to kill its Hero frequently. When he starts to disengage, focus fire on him with all your Towers. He may even run away towards your army! When the AI loses its Hero, its army will retreat.
Eventually, the AI spell-casters may get some auto-kill spells. At that point, you should consider keeping all your troops well behind your Towers.
You might want to build some Towers near your second mine in case the AI attacks with air units, which it won't. You also won't need any defenses at all in your original base. On the other hand, you might consider eventually getting some Gryphons. This is generally a waste of resources, because the AI has quite a lot of anti-air capacity, and in W3, anti-air rips air units to pieces.
There are a couple of islands on the Booty Bay map. How do you get there? You buy a Zeppelin or three at the Goblin Laboratory, that's how! There are a couple of ways of doing this very early that don't even require you to defeat the nearby creeps. The islands are heavily defended, but the AI will never be able to exploit the resources there, and it may never attack your positions there, either. Accordingly, you might be able to set up some island bases and perhaps win the game with air cav operations, EVEN IF you get wiped off the main continent. It turns out that the AI will buy Zeppelins if it stumbles across them, but it won't seek them out, and it won't use them effectively.
There are some additional details that you will need to know. Use Rally Points effectively for all your production buildings. Use control groups. Learn the aural cues and the elements of the heads-up-display. Use the keyboard. All of these things may seem very minor and unworkable to a beginner, but they are very important.
After beating the AI a couple of times, you will want to start playing with the default visibility rules. Then you will need a Gyrocopter. The only units that you can reasonably replace are workers. Instead of 13 workers, get only 11. With only 4 wood harvesters, you may become wood-limited, so spend some resources early on wood harvesting technology.
Once you can beat the AI reliably with humans on Booty Bay, then you can start playing the harder maps, and you can learn how to play the other races. On tiny maps, you can also have some fun Tower Rushing. Be aware, however, that beating the AI does not mean that you will beat a human opponent.