I would like to make a character that carries a walkman and headphones like Star-Lord from Guardians of the Galaxy. Is there any way to insert modern day technology like this according to the rules? If so, how?
If your DM lets you, you can do anything
This applies to almost everything in DnD 5e. If your DM says no, then you can't. If your DM says yes, then you can. The only thing you need to do is convince your DM to let you (though it might be beneficial to discuss with other players as well). In general, the best way to get people on board with something that doesn't quite line up conceptually with the existing rules is to have it be a "reskin" that has the same "rules" as an existing item/class/spell etc. but you'll describe it differently when roleplaying.
What to suggest
It sounds to me that you basically want a character that was "transported" from a Modern setting to a Fantasy setting, bringing along some sentimental item but using "local" equipment otherwise. In that case you wouldn't need to reskin a whole class or substantial items, you just need a Background and a Trinket. Backgrounds have a very consistent structure and fairly low power level, and customizing one is explicitly allowed by default, but it's also possible that an existing Background is close enough. Perhaps the "Far Traveler" from the Sword Coast Adventurer's Guide would work, or the Background could come from experiences other than the transportation; taking the example of Star Lord, I might give him the Criminal Background because his experience post-abduction seems to influence his "playstyle" the most while his actual origin is just roleplaying fluff.
As for a Trinket, there's a list of basic examples, and your Walkman is very similar to the "tiny gnome-crafted music box that plays a song you dimly remember from your childhood" from that list.
As a DM, I wouldn't even bat an eye if you describe your character concept as "pulled from a modern world" and have your Trinket be a Walkman with headphones, but take a default background. If you make a custom background, I would want to approve it before Session 1 but as long as it fits the pattern I wouldn't mind it.
On the other hand, if you want to use modern technology especially in combat, that would be a much more involved discussion since that has a much larger impact on the campaign's tone and themes, and would require reskinning a lot more concepts. There's nothing for this but to sit down with the whole group and explain the concept in detail to make sure everybody's on board with both having the concept in the campaign, and with the numerous reskins you'll need in order to get the character balanced.
TL;DR: You can only do this with DM permission. The fewer changes you make, the more likely you are to get DM permission.
Yes, with GM approval
There are a number of ways this is doable, but will rely on GM approval. Depending on the setting, this will be more or less likely. Here's a few sample settings with the options available for them. Keep in mind that working with your GM for homebrew options is always a possibility.
If you are already in a modern or post-modern world, this is easy to accomplish since the technology already exists. No official rules have been released for this time period so you'll have to ask your GM, but I doubt this is outside the realm of possibility. You could also ask your GM to allow the Walkman as a trinket as part of your starting equipment.
When you make your character, you can roll once on the Trinkets table to gain a trinket, a simple item lightly touched by mystery. The DM might also use this table.
If you're in a modern setting you may also want take a look at the Unearthed Arcana: Modern Magic. While these are unofficial playtest class options, they might add some depth to your character with some reflavouring.
High Magic Medieval Setting
In this type of setting, you will certainly need to work with your GM. There are a number of options for acquiring your Walkman since magic is understood to be more commonplace and powerful magic is feasible. I'll list a few relevant backstories to give you some ideas as a medium to show you the relevant rules.
- Abducted by Sphinx Magi
This one is the most similar to Star Lord's Backstory.
A group of cannibalistic wizard/cultists managed to gain control of a Gyno Sphinx and used her magic to travel forward in time and abduct you. They originally planned to eat you to see if people from the future tasted the same, but their leader decided instead to have you join their ranks after they traveled back into the past. All you have from your former life is a Walkman with a track your Mom gave you.
- The flow of time within the lair is altered such that everything within moves up to 10 years forward or backward
Use the Far Traveller background where the Walkman is part of your starting equipment. For example, replace the musical instrument proficiency with the ability to use your Walkman and the jewelry with the headphones.
- Discovered a Futuristic Object
This one is the most adherent to the official rules.
After leaving civilization in favour of a life more in tune with the natural world, you found an object of unknown construction in a grove in a long forgotten wood. You've learned to use this object and when worn and manipulated in just the right way, strange music plays through the nodules over your ears.
When adventurers find a piece of technology that isn’t from their world or time period, the players might understand what the object is, but the characters rarely will. To simulate a character’s ignorance about the technology, have the character make a series of Intelligence checks to figure it out.
[Details can be found in the Dungeon Master's Workshop section of the Dungeon Master's Guide]
Use the Hermit background where the Walkman is your Discovery. Discovery is a very GM dependent feature so you'll need to verify this with him/her.
- Walkman as a Magic Item
This one fits into the world better.
You come from a long line of artificers. Not powerful wizards who make swords that can slay demon lords or objects that shake the foundation of reality. Just mundane things like a broom that sweeps on its own or a doll that moves about. One such magic item is a device that plays music through a narrow helmet fitted over your ears. Your grandfather gave this to you when I left for my adventures: a token to remember home
This will involve a homebrew magic item that plays the music (Common rarity). You can compare similar items in Xanathar's Guide to Everything for balance. Here's one from that book:
Staff of Birdcalls
This wooden staff is decorated with bird carvings. It has 10 charges. While holding it, you can use an action to expend 1 charge from the staff and cause it to create one of the following sounds out to a range of 60 feet...
Creating specific sounds like a Walkman does is certainly within the balance range of common magic items. Try something like this (note: this homebrew has not fully analyzed for balance or playtested but is just an example for how you might design the item):
Band of Music
Wonderous item, common
When this band is placed over the head and covering a creature's ears, that creature can use it's action to push a button on the connected controller. Until that button is pushed again using an action, the creature hears music through the band covering it's ears. This music plays for a total of 120 minutes before it stops playing. It recovers any spent time from that 120 minutes at the next dawn.
The music the band plays is chosen by the magic items creator and cannot be changed without spending the necessary time and currency as if you were crafting the magic item in it's entirety.
Use the Inheritor background where the common magic item is your Inheritance. Obviously, since this is a homebrew item and the Inheritance must be approved by the GM anyway, you will have to check with him/her for this.
Low Magic Medieval Setting
In this type of setting, you will have a lot of difficulty since the magic to either create an item like this or have one arrive from the future is much rarer than a beginning adventurer would be expected to have encountered. Work with your GM to figure out if this idea is possible and how. Expect that you may have to chose something else in this type of setting
If it is okay with your DM, anything is possible.
As long as your DM allows it, there's no reason why you can't. That said, there needs to be a good reason for it or it will clash too much with the setting if it is still set in a medieval-fantasy setting. If you just want them to have a Walkman and headphones, then that would simply require your DM homebrew an item or two.
If you want your character to be based around creating modern technology, your DM would probably have to homebrew a class like Technomancer or Technician for you. While it can be done, you need to talk with your DM and see if (s)he is okay with your character being designed as such. However, if your DM is NOT okay with it, you should respect their decision because they probably have a good reason, even if that reason is something as simple as "I don't know how to make that work believably."
The 5E rules can be applied to any campaign setting desired, so you should ask your GM, or provide further details about the campaign that will be run.
The most common setting, and that detailed in the Player's Handbook, is a medieval setting
They begin with a foundation of medieval fantasy (Player's Handbook p. 5)
The middle ages is commonly understood to include the period between the 5th century AD and 1453, but the High Middle Ages (around 1100 AD to about 1250 AD) is the template most often followed for the Swords and Sorcery style that most people think of. Arthurian legend is typically placed in the Early Middle Ages (circa 5th century), and so whichever route you go, this implies that any technology more recent than about 1200 AD is unavailable by default.
While this is not explicitly stated in the books, the equipment selection strongly correlates with this notion, with more modern equipment only briefly detailed in a special section of the DMG as optional rules. (from memory as I don't have the book handy at the moment)
That said, automatons of various kinds do make an appearance - think robots powered by magic - so this is only a general rule. As well, many fantasy campaigns allow guns, albeit matchlock style weapons, not anything as modern as a revolver or semi-automatic. Gnomes, being tinkerers, also allow for any type of fantastical gadget or trinket that a player and GM conspire to allow.
And, as mentioned earlier, any setting, including modern or futuristic, can be run depending on the GM's and players' desires.
However, with your GMs permission, you can come up with some magical equivalent of various types of modern technology. It is not by the book, so to speak, but anything your GM allows is valid (this is what is commonly called a "house rule").
I'm not sure how you might flavor the headphones - something like a boombox is probably easier to envision in a fantasy setting (as a variation on Magic Mouth perhaps) - but there's no reason that you couldn't work something out with the GM, especially for something largely cosmetic like what you propose.