When you knit, the yarn has to come from behind your needle.
When you purl, the yarn has to come from in front of your needle.
When you switch between knit and purl, you have to bring the yarn between the needles to the back for knit and to the front for purl.
What you were doing were accidental yarnovers where the yarn was wrapping around the needle an extra time.
"Trust the pattern!"
Time flies like an arrow, but fruit flies like a b