Was my approach to this girl in the gym alright?

Hey guys and gals, I'd appreciate some opinions here, because I'm not too sure if my approach was good.

Here's what happened:
I noticed a cute girl working out with some two other friends at the gym I go to. I decided to approach her since she wasn't wearing the super revealing gym stuff that most girls there wear (I value modesty a lot) and in part because I thought she'd feel more safe since she was with friends.
I walked up and I guess she didn't see me because she turned around. When she noticed me waiting for her to notice me, she removed her headphones and asked what I wanted. I just said "Hi, I'm Adam. I thought you were cute and wanted to meet you."

Then I made some polite small talk with her and her friends about what their workout was like today, how they knew each other, the local university they attended, etc. The girl I approached was a freshman, one friend was a sophomore and the other was a junior. They asked if I went there and I said I was there up until 2022. The one friend said "oh so you must be super old then." And I said "I'm 26. Is that old?"

A little more small talk, and I asked the girl "Hey can I get your number so we can go bowling or something?" She said sure but she didn't have her phone, so she headed to the lockers with one of the friends.
I thought she just misunderstood that I wanted her to put her number in my phone, not mine in her phone, so I waited for her to come back and politely talked some with the second friend. Some guy who seemed to know the friend came up and protectively checked out what was going on. Talked with him for a minute.

The first friend came back and told me "she has a boyfriend" so I left and continued my workout.

Sounded like they were gossiping or shocked about it and I think I heard the dude gossiping about it later, so I'm wondering if I struck a nerve in a bad way or whether something was awry.

Was my approach ok? I don't mind being rejected, but I want to try to make everyone comfortable.
Was my approach to this girl in the gym alright?
Post Opinion