TL;DR: People think the Millennium Falcon is a piece of junk because... well, because the Millennium Falcon is a piece of junk.
The Falcon is like a crappy old 1910 freight truck with an insane number of modifications, and the engine of a modern high performance race car. This causes all kinds of problems, which require an endless succession of repairs and jury rigged quick fixes. This wouldn't be so bad, if the guy responsible for most of the work wasn't Han Solo:
And Chewbacca is great and all, but he did put C-3PO's head on backwards.
These two dudes are awesome characters and great pilots, but they aren't the best mechanics in the galaxy.
As has been pointed out before, the Falcon is frequently in very bad shape in the original trilogy:
Percussive maintenance1 (at 1:50):
Percussive maintenance is used so often on the Millennium Falcon that it was one of the predictions in Darths And Droids: The Force Awakens Bingo.
Han Solo used [percussive maintenance] to fix a sputtering Millennium Falcon, in The Empire Strikes Back. Given the general state of the ship and Han's personality, it's a minor miracle that he only does this once.
In the Expanded Universe, he does it often enough that he and Lando (the Falcon's previous owner and one of Han's best friends) refer to it as "Emergency Repair Procedure Number One".
- TV Tropes
Han isn't the only one who subjects the Falcon to physical abuse in the name of repairs:
Chewbacca and Solo spent hours modifying and tinkering on their beloved Falcon, souping it up far beyond its original performance specs. Although the Falcon's upkeep was a labor of love, many a time Chewie unleashed his legendary temper on the recalcitrant freighter, banging his massive furry hands against delicate components that refused to behave.
And there has been a lot of work done on the Falcon, giving both Han and Chewie plenty of chances to smash the hell out of it:
All of [the Falcon's] modifications come at a price. They haven’t been professionally installed and, while Solo and Chewbacca generally have a handle on things, the huge amounts of unlicensed components have made for a ship that’s almost constantly under maintenance.
- Screen Rant
Which causes problems, because Han is the worst mechanic ever:
Han knows that the only things keeping the Falcon in one piece is duct tape and positive thoughts:
Leia: [to Han] We've lost lateral controls!
Han: [to Leia] Don't worry, she'll hold together!
Han: [quietly, to the Falcon] Come on baby, hold together!
- A New Hope
As does Lando:
You know, that ship's saved my life quite a few times. She's the fastest hunk of junk in the galaxy!
- The Empire Strikes Back
And this is confirmed on the Star Wars Databank website:
Despite her humble origins and shabby exterior, the Millennium Falcon has played a role in some of the greatest victories of the Rebel Alliance and the New Republic. The Falcon looks like a worn-out junker, but beneath her hull she’s full of surprises. A succession of owners, from Lando Calrissian and Han Solo to Gannis Ducain, have made special modifications that boosted the freighter’s speed, shielding and firepower to impressive – and downright illegal – levels. The price of such tinkering? The Falcon can be unpredictable, with her hyperdrive particularly balky.
- Star Wars Databank
And numerous other sites, including Wookieepedia:
The cobbled-together nature of the ship presented many problems throughout her smuggling days and during the Galactic Civil War. Systems were barely held together and apparently had many incompatibilities, resulting in numerous malfunctions. C-3P0 commented that he wasn't quite sure where the ship learned to communicate... Years after the Battle of Endor, Han Solo and/or Chewbacca appeared to have resolved these difficulties, much to the relief of Leia Organa...The resolution of those problems may have involved a virtual rebuild of her internal operation systems; this was never discussed in detail.
In an effort to reduce his expenses and maintain his privacy, Solo modified the Falcon so that most of her major systems could be accessed through the cockpit or the engineering station in the main cargo hold. The myriad of ship control functions were funneled through what was once a Hanx-Wargel SuperFlow IV computer. It has since been modified with three droid brains, which caused the Falcon to have schizophrenic arguments with herself.
The Falcon's unkempt interior matched her dilapidated exterior. The interior corridors were littered with all sorts of mechanical gear.
In fact, a real life engineering company has said that the Falcon's unreliability must make her upkeep and maintenance costs astronomical (no pun intended):
SGS Engineering, a UK company specializing in hydraulics, did the calculations and figured that Han Solo must have a considerable fortune stashed away somewhere.
The engineering firm took the Millennium Falcon out of its fictional universe and treated it as if were a real vehicle in our world. SGS worked out that it would cost over $3 million (about £2 million, AU$4.2 million) just to keep the spaceship up to date on repairs and maintenance for a year. And that's for a "good year," not counting the toll taken by hiding in asteroid fields or fighting the forces of the Empire.
SGS cites the Falcon's reputation for being unreliable along with its age (over 50 years) when sorting out the cost of parts and labor to keep it flying as the fastest ship in the galaxy. The figure is based on data taken from the annual maintenance costs of commercial jets, fighter jets and labor rates from our real world.
"Anything mechanical that is known as a hunk of junk is going to be expensive to upkeep," notes SGS owner and founder Andy Wyatt. "We're not professing that these are definitive calculations, there is a certain amount of conjecture in there -- after all there's not much to base a replacement hyperdrive on -- but they do give a good idea of just how much of a financial burden the Millennium Falcon would have been on Solo."
Out of Universe:
People think the Falcon is a piece of junk because it looks like a piece of junk, and it looks like that because Lucas wanted it to. He didn't want to make another pristine science fiction movie, he wanted his world to look real and lived in; a smuggler's cargo ship in such a world would look battered and beaten up, not nice and pretty.
[Lucas] didn't want anything [in Star Wars] to stand out, he wanted it all real and used. And I said, "Finally somebody's doing it the right way." All science fiction before was very plastic and stupid uniforms and Flash Gordon stuff. Nothing was new. George was going right against that. My first conversation with him was that spaceships should be things you see in garages with oil dripping and they keep repairing them to keep them going, because that's how the world is. So we had the conversation and I got hired. I was the third person hired on Star Wars, in fact.
The Millennium Falcon was difficult, because I had to train prop men to break down jet engines into scrap pieces and then line them all up into different categories and stick them to the walls.
- Esquire interview with Roger Christian, who designed the Falcon
It was always Christian's intention for the Millennium Falcon to "look like an old car that had been repaired many times, rugged and dripping with oil." And in creating Solo's second-hand smuggling vessel, he took a very literal approach.
"The cockpit was the first set we ever build," says Christian. "I just kept having to buy more and more junk. It was eating it up. ... Then I gave the set a spray to make it look grimy.
- CNN interview with Roger Christian
This is part and parcel of the "Used Future" Lucas helped to create, as TV Tropes explains:
Of course Star Wars more or less defines this trope, where every ship is covered with dings and scratches, and [the trope is] epitomized by the Millennium Falcon, which looks like it is almost ready to fall apart. This extends to the sound design as well, apparently George Lucas's instructions were that he wanted to hear every loose bolt in the engines.
- TV Tropes
1 "Percussive maintenance" is a tongue-in-cheek term used to describe the act of 'repairing' something by smacking it as hard as possible.