The modern Cyrillic letter for ya has an origin story that people regularly get half right, and the half that gets left out is the interesting one.
Old Church Slavonic had two letters that came to matter here. One was this iotified a, a ligature writing the glide plus a. The other was the little yus, writing a nasal front vowel, a sound with no glide in it at all.
In the East Slavic area the nasal vowels were lost early, and the nasal front vowel fell in with the sequence the iotified a wrote. Two letters were now writing one thing. What happened next was decided by the pen rather than by any principle: the little yus was the simpler shape to write and it won, while the sound it now stood for was the one the iotified a had carried.
So the modern letter descends in shape from a letter for a nasal vowel and in function from a ligature for a glide, and neither ancestor alone explains it. Anyone tracing it back through the shape lands on the nasals and concludes that Russian once had them, which is true but is not what this letter is evidence for. Anyone tracing it back through the sound lands on the iotified a and finds a shape that looks nothing like the modern letter.
Letters merge like this more often than tidy histories suggest, and the merger is usually invisible afterwards, because a script preserves only what survived and not what it displaced.