The Infinity Stones were at the center of the Marvel Cinematic Universe's Phase 3 conclusion, but who knew about them in the MCU before The Avengers thanks to the Tesseract, while the latter film also unknowingly used the Mind Stone through Loki's Scepter.
It wasn't until midway through Phase 2, though, that Infinity Stones were directly mentioned. The post-credits scene for Doctor Strange brought the fifth Infinity Stone to the MCU by revealing the Eye of Agamotto held the Time Stone.
All of this was done as the build-up for Thanos' true MCU arrival and going to war with the Avengers in Avengers: Infinity War and then Soul Stone's location on Vormir. While Thanos otherwise had a rather intricate knowledge of the Infinity Stones' powers and locations heading into the movie, many characters in the MCU knew about them too.
Thanos
As the being after the Infinity Stones, Thanos knew more about them than just about anyone. It is unknown when the Mad Titan first learned about their existence, but he spent at least a few years before Avengers: Infinity War trying to manipulate others into getting the stones for him. We even know that he at one point had the Mind Stone in his possession but gave it to Loki to try and get the Space Stone. The MCU hasn't revealed when Thanos acquired the Mind Stone originally, but having it could be how he managed to learn about the rest of the Infinity Stones existing.
Guardians of the Galaxy
Guardians of the Galaxy saw the entire team learn about the Infinity Stones in 2014. Gamora knew about them already as a daughter of Thanos and wanted to make sure he did not acquire the Power Stone. We also know from Avengers: Infinity War that she was previously tasked with finding the Soul Stone for him. Due to this assignment and her success in discovering the Soul Stone was on Vormir, Gamora presumably had a wealth of knowledge about the Infinity Stones before the movie even began. It is also likely that Nebula learned about them during her time with Thanos as well.
As for the rest of the Guardians of the Galaxy, it was on Knowhere that they learned about the Infinity Stones. Star-Lord, Drax, Rocket, and Groot were told about their history and that they now possessed one of them. They went on to have direct with the Power Stone, as Peter was able to wield the Infinity Stone's power with the help of the other Guardians.
The Collector
One of the MCU's characters with the best knowledge of Infinity Stones is The Collector. We don't know how he came to know so much about them, but he was the one who explained what they were to the Guardians of the Galaxy. However, his first interaction with an Infinity Stone came in the post-credits for Thor: The Dark World, which is when he came to possess the Reality Stone. He might have had plans to acquire all six for his own purposes, but he lost the Reality Stone during Avengers: Infinity War.
Nova Prime & The Nova Corps
The events of Guardians of the Galaxy also led Nova Prime and other of the Nova Corps to know about Infinity Stones, if they didn't know about them already. They were selected to keep the Power Stone on Xandar so they could keep it safe. While that ultimately didn't work based on Avengers: Infinity War's opening, Nova Prime and her subordinates knew what they were guarding long before Thanos attacked.
Ancient One
The Ancient One also had knowledge about the Infinity Stones long before Avengers: Infinity War. While her presence in Doctor Strange never saw her actually use the Time Stone, we know from Avengers: Endgame that she did wear the Eye of Agamotto from time to time. More importantly, the Ancient One had a supreme understanding of what the Infinity Stones meant for reality. The 2012 version of her was the one who explained to Bruce Banner that they were instrumental to the very fabric of each timeline. Since she's hundreds of years old, there's no telling when The Ancient One first found out about the existence of Infinity Stones.
Doctor Strange & The Masters of the Mystic Arts
It was in Doctor Strange that Stephen Strange first learned about the existence of Infinity Stones. At the very end of the movie, Wong tells Strange that an Infinity Stone resides inside the Eye of Agamotto. This confirms that Wong also knew about Infinity Stones, while the nonchalant mention of them could point to other of the Masters of the Mystic Arts, such as Mordo, also knowing about them.
Thor
While it is possible Thor knew about Infinity Stones long before Avengers: Infinity War, it appears he first discovered them during Avengers: Age of Ultron. He had a vision of the Infinity Stones during the movie and came to understand their power. This was supposed to set up Thor searching for the Infinity Stones, but Thor: Ragnarok abandoned most of that plot.
Most of The Avengers
Avengers: Age of Ultron also was responsible for most of the present and soon to be of the Avengers learning about the Infinity Stones. After Thor stepped in to help bring Vision to life, he explained to Iron Man, Captain America, Bruce Banner, Hawkeye, Scarlet Witch, Quicksilver, and Vision that the gem in the android's head was the Mind Stone. It's possible, if not likely, that Black Widow was told the same later on, but that didn't happen on screen. Instead, it was Iron Man and Cap who were told at the end of the movie by Thor that this was the fourth Infinity Stone to appear in recent years, potentially giving them a bit more knowledge than the rest.
Lady Sif & Volstagg
The end of Thor: The Dark World also brought confirmation that Lady Sif and Volstagg know about Infinity Stones. They were aware that both the Aether and Tesseract were actually Infinity Stones. It is likely that Fandral and Hogun - the two other of their team - also are aware of Infinity Stones, but that is not confirmed. It is unclear if they've known about Infinity Stones for some time or if they were just told about them prior to this mission.
Odin
There is plenty of evidence to Odin also knowing about the Infinity Stones before his death in the Aether's tremendous power.
Loki
Loki also definitely knew about the Infinity Stones, even if he never outright says so in the movies. Whether he knew about them during The Avengers is unclear, but he had to of known by the end of Thor: The Dark World. Since he was the one posing as Odin at the end, it was ultimately his decision to keep the Tesseract and Aether away from each other. This suggests he knew both of them were Infinity Stones, especially since Loki took the Tesseract again at the end of Thor: Ragnarok.
Red Skull
Red Skull is one of the earliest people searching for an Infinity Stone in the MCU movies, but it is unknown if he knew that at the time. Even if he didn't know that the Tesseract was an Infinity Stone during the 1940s, he found out about the Infinity Stones once he touched it. The Tesseract transported him to Vormir, where he became the guardian of the Soul Stone.
Ego
Ego is almost as old as the universe itself, so it is no surprise that he also was aware of Infinity Stones. It is unknown when he first learned about their existence, but he was well aware of their incredible power. This is how he knew the person who managed to hold one must be his son, which sent him on his quest to find Star-Lord.
Ronan
Guardians of the Galaxy also saw Ronan discover the Infinity Stones through his quest to find the Orb for Thanos. He was originally unaware that the Power Stone was inside. When he found out, Ronan merged the Power Stone with his hammer and broke off his partnership with Thanos.