It's all in definitions. In every trade someone buys and someone sells. When you are the high bidder and someone sells at that price they came down from the lowest ask at that time to meet your bid, hence a "sell."
If you had raised your bid to meet the lowest ask at that time it would be considered a "buy."
FWIW I don't like to use "buy" and "sell." I prefer "transaction at the bid" or "transaction at the ask"