He's a genie. He can do magic stuff, rides a carpet like in old Arabian and Iranian literature. There are claims online that a Jewish scholar by the name of Ben Sherira wrote tales of King Solomon riding a magic carpet, but there's no evidence online that he's even real (he's said to be from about the 13th century CE. There is a scholar Hai ben Sherira from 1000CE, but no "Ben Sherira" from 1300) - in fact, the history websites that talk of Ben Sherira cite this https://www.jstor.org/stable/43472497?seq=1 which is a fictional story by a Pakistani-Australian author, which he describes as fiction in this interview (ctrl+F "magic carpet"): https://web.archive.org/web/20090101003118/http://us.penguingroup.com/static/rguides/us/passarola_rising.html
Don't believe everything you read online!
For example, this "history" site cites that work of fiction lmao
https://curioushistorian.com/magic-flying-carpets-the-historic-version-not-the-disney-version
Not the disney version, but still fiction you fucking mong
edit: gotta say though, just read the Pakistani guy's work on Jstor (have to make an account) and he writes it in a way that looks like a real actual academic paper, despite it being fiction. What a dick, confusing as hell.