Everyone knows that Hawkeye is a good guy, and if your only information about him stems from the MCU, there's no way you would know otherwise. As it happens, ole' Clint Barton began life in Marvel Comics via Tales of Suspense #57, where he was a villain.
Fortunately, he didn't remain that way for too long, so it's not unusual to gloss over this detail about his backstory. His two subsequent appearances in Tales of Suspense #60 and #64 continued his villainous streak, but it came to an end after that.
His road to becoming a bad guy came when he met Black Widow while she was working as a spy for the Soviet Union. He fell in love with her, and his attachment to her led to his doing some illegal things. Her interests in stealing Stark technology were aided by Hawkeye's bow, so he participated in an international espionage scheme.
When she was injured soon after, he realised he wasn't on the right side of things, and he set his sights on becoming an Avenger. He eventually did exactly that by joining the team's ranks in Avengers #16, when Cap reformed the team under his leadership.