Wish is a 9th-level spell. It’s only on the wizard and sorcerer spell lists.
Full caster classes (including sorcerers and wizards) gain 9th-level spell slots at level 17 in the class. Multiclassed spellcasters know/prepare spells as if single-classed, so you need at least 17 levels in either sorcerer or wizard to have a 9th-level spell slot and thus be able to learn the spell.
The one exception is the bard class, thanks to their Magical Secrets feature:
By 10th level, you have plundered magical knowledge from a wide spectrum of disciplines. Choose two spells from any class, including this one. A spell you choose must be of a level you can cast, as shown on the Bard table, or a cantrip.
The chosen spells count as bard spells for you and are included in the number in the Spells Known column of the Bard table.
You learn two additional spells from any class at 14th level and again at 18th level.
Using the Magical Secrets feature, you can learn 2 spells from any class spell list at 18th level. As full casters, bards also get a 9th-level slot by that point, so they can learn wish using the feature.
Finally, Arcana Domain clerics get the Arcane Mastery feature at 17th level (SCAG, p. 126):
At 17th level, you choose four spells from the wizard spell list, one from each of the following levels: 6th, 7th, 8th, and 9th. You add them to your list of domain spells. Like your other domain spells, they are always prepared and count as cleric spells for you.
They could choose wish as their 9th-level spell from the feature. (Thanks to David Coffron for pointing this out!)
There are a few magic items that can let you cast the wish spell or cast it for you. However, it’s up to the DM whether to even roll on the tables to determine treasure, or whether to allow you to gain items that let you cast the wish spell. Given how powerful wish can be, the DM might be hesitant to do so any sooner than you could normally learn the spell.
The lowest-rarity item, the Efreeti Bottle, is still listed as “very rare”, and only has a 10% chance of giving you wishes:
When you use an action to remove the stopper, a cloud of thick smoke flows out of the bottle. At the end of your turn, the smoke disappears with a flash of harmless fire, and an efreeti appears in an unoccupied space within 30 feet of you.
The first time the bottle is opened, the GM rolls to determine what happens.
On a roll of 91-00 on the percentile dice (“d100”), it gives the following result:
The efreeti can cast the wish spell three times for you. It disappears when it grants the final wish or after 1 hour, and the bottle loses its magic.
All but one of the remaining items that allow you to cast wish are legendary items. The first and probably most controversial is the Deck of Many Things. Only one of the cards in the Deck, the Moon, lets you cast wish (with the other possible effects ranging from campaign-destroyingly good to campaign-destroyingly bad):
Moon. You are granted the ability to cast the wish spell 1d3 times.
A much simpler item that lets you cast wish is the Luck Blade:
Wish. The sword has 1d4–1 charges. While holding it, you can use an action to expend 1 charge and cast the wish spell from it. This property can’t be used again until the next dawn. The sword loses this property if it has no charges.
The Ring of Three Wishes is probably the most straightforwardly named of the bunch, and does what it says on the tin:
While wearing this ring, you can use an action to expend 1 of its 3 charges to cast the wish spell from it. The ring becomes nonmagical when you use the last charge.
And finally, the last item (or pair of items) is an artifact, the Eye and Hand of Vecna (DMG, p. 224). Attuning to both items involves some self-mutilation (and removing either one afterwards kills you), but you gain a variety of benefits and incur a few dangers. If you attune to both, the last benefit listed is:
You can use an action to cast wish. This property can’t be used again until 30 days have passed.
There is, of course, the possibility (however unlikely) of acquiring a 9th-level spell scroll with the wish spell on it. Spell scrolls can only be used by those with the spell on their class spell list, so only sorcerers or wizards can do it (or bards who pick the spell with the Magical Secrets feature, but they’d already know the spell that way so it’s kind of pointless for them). Note that even lower-level sorcerers/wizards could use a wish spell scroll, but they’d have to pass a DC 19 check using their spellcasting ability (Charisma for sorcerers, Intelligence for wizards):
If the spell is on your class’s spell list but of a higher level than you can normally cast, you must make an ability check using your spellcasting ability to determine whether you cast it successfully. The DC equals 10 + the spell’s level. On a failed check, the spell disappears from the scroll with no other effect.
The Magic Item Rarity table on DMG p. 135 suggests that very rare items be limited to 11th-level or higher characters, and that legendary items be limited to 17th-level or higher characters.
However, the magic item tables on the following pages do list specific magic items as possible treasures, and the treasure hoard tables do give guidance on randomly determining the contents of a large cache of treasure, whether that’s the accumulated wealth of a large group of creatures, the belongings of a single powerful creature that hoards wealth, or a reward from a wealthy/powerful benefactor for completing a quest (DMG p. 133):
When determining the contents of a hoard belonging to one monster, use the table that corresponds to that monster’s challenge rating. When rolling to determine a treasure hoard belonging to a large group of monsters, use the challenge rating of the monster that leads the group. If the hoard belongs to no one, use the challenge rating of the monster that presides over the dungeon or lair you are stocking. If the hoard is a gift from a benefactor, use the challenge rating equal to the party’s average level.
Every treasure hoard contains a random number of coins, as shown at the top of each table. Roll a d100 and consult the table to determine how many gemstones or art objects the hoard contains, if any. Use the same roll to determine whether the hoard contains magic items.
The Efreeti Bottle corresponds to a roll of 71 on the d100 on Magic Item Table H (DMG p. 148). Magic Item Table I (DMG p. 149) includes the Luck Blade (corresponding to a roll of 11–15), the Deck of Many Things (81), and the Ring of Three Wishes (94).
The table for treasure hoards corresponding to CR 5–10 creatures (DMG, p. 137) has two rows that involve rolling once on Magic Item Table H; following these guidelines, it’s only possible if the DM rolls 99 or 100 on the d100 when determining the treasure hoard. In order to then get an Efreeti Bottle, the DM would need to roll a 71 on another d100 for the magic item table. (And in order to then have the efreeti grant you 3 wishes, they’d need to roll a 91-00 on the d100 when the bottle was actually used by a character.)
Alternately, the treasure hoard table for CR 11–16 creatures (DMG, p. 138) includes a few more rolls that could theoretically result in an item that lets you cast wish. If the DM rolls 83–92 on the d100 for the treasure hoard table, they can roll 1d4 times on Magic Item Table H (to potentially get an Efreeti Bottle). If they instead roll 93–00 on the d100 for the treasure hoard table, they can roll once on Magic Item Table I. (And they’d then need to roll an 11–15, 81, or 94 on the d100 for the magic item table to result in an item that can let you cast wish.)
Finally, the treasure hoard table for CR 17+ (DMG, p. 139) states that a roll of 73–80 corresponds to 1d4 rolls on Magic Item Table H; a roll of 81–00 corresponds to 1d4 rolls on Magic Item Table I.
Artifacts (such as the Eye and Hand of Vecna) are a totally different beast, beyond even the highest treasure hoard or magic item tables (DMG, p. 219):
An artifact is a unique magic item of tremendous power, with its own origin and history. An artifact might have been created by gods or mortals of awesome power. It could have been created in the midst of a crisis that threatened a kingdom, a world, or the entire multiverse, and carry the weight of that pivotal moment in history.
Characters don’t typically find artifacts in the normal course of adventuring. In fact, artifacts only appear when you want them to, for they are as much plot devices as magic items. Tracking down and recovering an artifact is often the main goal of an adventure. Characters must chase down rumors, undergo significant trials, and venture into dangerous, half-forgotten places to find the artifact they seek. Alternatively, a major villain might already have the artifact. Obtaining and destroying the artifact could be the only way to ensure that its power can’t be used for evil.
All in all, the DMG does not really expect low-level characters to be able to cast wish even through magic items. You can only expect to have a fairly significant chance to get a magic item that lets you do so once you’re already high enough level to cast the spell (assuming you don’t multiclass). This is probably at least somewhat by design, given that even the spell description begins:
Wish is the mightiest spell a mortal creature can cast. By simply speaking aloud, you can alter the very foundations of reality in accord with your desires.
Frankly, you’re better off talking to your DM about finding a way to cast simulacrum directly rather than trying to cast wish to replicate its effect, given how potentially world-changing (and campaign-affecting) wish can be.