I have seen the Shuttle named a "flying brick" multiple times. However a brick, as understood in the building industry, is a simple rectangular shape without wings and without any adaptation of the form. If the Shuttle was only capable of that much, why could not it be a lifting body like Martin Aircraft X-24?
The small wings make it fly like a brick. Without the wings it would fly like a stone.
Seriously, you are taking the expression too literally. The Space Shuttle is landing like a glider plane with a (not so good) glide ratio of about 4.5:1 (see What was the Space Shuttle's glide ratio?). No brick would be able to achieve that.
Designing the Space Shuttle as a lifting body ( ≠ brick) was actually considered. It appears that a lifting body design was not able to comply with the flight envelope requirements.
As everyone has pointed out, it's a joke. Others have answered the lifting-body question (it didn't meet design requirements), so I just wanted to expand some thoughts on the spirit of the "flying brick" nickname.
I suspect whoever came up with the term didn't spend a lot of time analyzing it. However, I think it's significant that the nickname is flying brick - not falling brick. It doesn't imply that the shuttle doesn't have wings or can't fly. Instead, it implies that the vehicle has blunt and non-smooth surfaces which creates tremendous drag (like a brick) and limits its glide ratio.
For my talk on how to land the space shuttle, I created this visual, which I think captures the spirit of the nickname:
Unfortunately, even though I think you knew this was a joke, a lot of people take jokes and analogies too seriously and turn them into conspiracy theories. I get lots of comments on my talk from people who think that, if the shuttle flies like a brick, it can't possibly be a glider and therefore... space is fake. 🤦🏻♂️ (/facepalm) So... I don't think having serious answers to a question like this is a bad thing.
In addition to its poor glide ratio the shuttles name also stems from the materials its made from as much as it does its poor glide performance. The Space Shuttle's heat shield was made out of LI-900 Silica tiles that strongly resemble bricks and thus the shuttle was sometimes called the "Flying Brickyard".
If you would like to know why NASA chose a wing design over another capsule or lifting body they actually published an explanation here as to their choices. In short it was a mix of socio-political pressures and old school "airplane" mentality where many of the engineers came from, a large chunk of Air Force requirements driving the original designs and hard engineering reasons that lead to the Delta Wing vehicle that was ultimately built.
In response to the other portion of your question, A lifting body could be used and that is basically the design of Sierra Nevada Corporation's new Dream Chaser.
"Flies like a brick" is merely a figure of speech. It comes from personal feelings of the pilot when comparing it to an actual plane.
It's just like the saying that someone is "dumb as a rock". Obviously, even the most stupid person (or even animal) is much smarter than rock. The saying merely expresses the frustration of the speaker when dealing with a person that stupid.
"Flies like a brick" was coined most likely because of combination of its abysmal glide ratio (1:1 at its worst, 4.5:1 at it's best) with simultaneous (and counter-intuitive) reliance on it. Compare it to a 747 which has quite poor glide ratio of 17:1 and it's not supposed to glide. Sailplanes have over 50:1, so that's the kind of performance a sane person would expect from a vehicle that's meant to do nothing but glide.
An actual brick has glide ratio of about 1:10. In fact, the Space Shuttle flies more like the best sailplanes (11× difference) than like a brick (45× difference). Surprisingly, it's marginally better than Concorde at take-off (4:1), but not at speed (12:1).
I couldn't find the glide ratio of an X-24, but it must have been considerably better than 1:1 (to be considered flying instead of falling), so that's still more than 10× better than a brick.
Adding to other answers, yes space shuttle is a brick that flying not just a brick. Body-lifting can not be disregarded in hypersonic flight during the reentry, it is not just the wing creating the lift, it is the whole bottom section hitting the atmosphere.
Looking at another famous spacecraft, Appollo, it doesn't have any conventional wings but NASA uses only CG shift and altitude control to achieve atmosphere skipping because the body lifting from its bottom side. This documentary explains how it is done:The wing also gives the shuttle huge landing flexibility, or what called the "cross-range" which brings to my third point.
Changing direction in orbit takes a crazy amount of energy and in orbit, you are on "rail" sort of speak. The Earth rotates below you and to return you have to wait until you got a close passage across your landing site. However, with Shuttle's relative big wings, it has a huge of cross-range(it is actually a design goal originally from the Air Force), the shuttle can make big direction change during reentry just like a normal airplane. It has about 1100 nautical miles in cross-range, which means the closest approach to Cape Canaveral could be as far out as in the middle of the Atlantic Ocean and still be able to glide back.