Hotly tipped for six years, the singer had given up fame before Fancy, the song she co-wrote for Iggy Azalea, topped the US charts. Is it enough to put an end to her panic attacks?

The other customers in a cafe in London's King's Cross stop what they're doing to stare. Charli XCX has just decided to demonstrate how she suffers from anxiety by climbing on to the extra-long table and crawling along it on all fours, like a disobedient toddler. "I do this weird thing in studios where I climb stuff when I get nervous," she explains. "So if we were in the studio right now, I'd be on the floor doing all of this weird shit. Stuff like that happens. That's my panic attack. Once I ran out of a studio through a window because I was so worried about passing the person that I was having this awkward moment with, so I picked my bags up and went." She adds the disclaimer that it was on the ground floor, but it was a window, "And I took the blinds out with me."

Maybe that behaviour doesn't seem so odd when you consider the position she was in back in January this year, when no one was staring, and she wasn't anticipating becoming the breakout international star of the summer. At 21 years old, six years after beginning her career and after being repeatedly tipped for huge success, she had pretty much resigned herself to life as a recluse, spending each day in bed, in her pants, eating cake and preparing to sack off ambitions as a pop star for a career as a behind-the-scenes songwriter instead: while she hadn't managed a big hit under her own name, she'd written Icona Pop's worldwide 2013 hit I Love It. "I was kind of just over everything," Charli says drolly. "And then Fancy blew up."

Fancy, the Iggy Azalea single that Charli co-wrote and has a featured performer credit on, spent seven weeks at the top of the Billboard charts, selling more than 2.7m copies in the US alone. She has now followed that with her first US top-20 solo hit, Boom Clap, a bombastic synth-pop serenade bursting with the self-assured atittude of Bananarama and Gwen Stefani, which is also the soundtrack to the teen heartbreak movie The Fault in Our Stars. Everything has changed since January.

Charlotte Emma Aitchison suits the bold, bratty music she makes. Her mass of black curls swept across her head in a style adopted by Lorde, she's dressed up in a ribbon choker, silver slip dress, goth flatforms and a tatty leather jacket. Her image pays homage to Courtney Love and the trillions of grunge girls who inhabit Tumblr, but although she describes herself as "punk", Charli – the XCX stands for X-rated Cunt X-rated – looks more likely to get ludicrously drunk in a pub and cajole the local DJ into playing Smells Like Teen Spirit or Wannabe, as opposed to, say, snorting her dad's ashes or carving 4 Real into her arm with a razor blade.

Still, she says, she's currently "back and forth with emotions". She says she wants to be a pop star, and then that she wants to make a punk album. She revels in her meandering route to success, but goes on to say she hates the way her career has moved so slowly. It has been a stilted trajectory so far, when you consider the Guardian first wrote about her in 2008, describing her as "the female Frankmusik, the Fisher Price Fischerspooner" based on her debut single !Franchesckaar!; a track which now sends feverish flashbacks to Trash Fashion's It's a Rave Dave. Initially indebted to the sweaty thralls of the nu rave scene, Charli gained a name for herself through her anarchic, exhibitionist performances at warehouse parties in east London throughout her teens, where she was eventually spotted by Atlantic subsidiary Asylum, who she signed with in 2010. By the time her debut album proper came out, nu rave had melted into the witchouse hipster scene and Charli turned her attentions to darkwave electro-pop: but her image and sound turned out to be too twee for the leftfield crowd and too postmodern for the pop scene.

Perhaps she is discombobulated by the pace of this past year, and by finally stepping into the limelight in her own right. Though she has already released two albums – 2008's 14, funded by her family, and 2013's True Romance, a dishevelled yet inventive collection of alt-pop songs that was critically well-received and earned her comparisons to Grimes and early Madonna. Neither set the world alight however, with True Romance creeping to No 85 in the UK charts. Right now, though, she seems to be in line for her proper stab at the big time.

"I've never conformed to what my record label has said and, yes, that has meant that it's been a long journey for me," she says, "but I now have full control of my project, full respect from everyone I work with. Because I didn't take any shortcuts."

Charli XCX performs during T in the Park 2014 at Balado on July 11, 2014 in Kinross Photograph: Ollie Millington / Barcroft Medi

It may smack of spin, but there have been plenty of times when she could have surrendered her independence to achieve that first hit – she rejected a Christina Aguilera collaboration, and she has been writing with Dr Luke, one of the most prolific hit writers of recent years, but Charli says she would not release any of their tracks as her own.

"I've always played it my way," she says. "I failed media training, for example. I did it against my own will when I was a lot younger. And the person who did it with me was like: 'Out of all my 10 years of media training, Charli XCX was the worst person I've ever trained.' And I was like: 'Oh my God, what did I do so wrong?' I've never been good at, 'Hey, like, totally awesome.'"

Her compulsion to paint herself as a rebel may seem contrived, given that Charli has been inside the major label machine since her teens, but it also gives her a sense of fragility and vulnerability that makes her easier to relate to than, say, Lorde and her terrifyingly solemn intellectualism, or the rolling cast of young female stars from the Disney troupe. She also has the ability to write hooks so sweet they should come with a warning about the recommended daily intake of sugar and girl gang choruses so catchy she describes them as "borderline annoying".

Charli XCX performs with Iggy Azalea. Photograph: NBCU Photo Bank via Getty Images

She is, she says, prone to panic. "I have panic attacks and I have breakdowns, and stuff like that, so I feel like if I'm just like la la la la la …" she waggles her head as if it's in the clouds. "Now I panic more about like running out of slip dresses to wear. That's my main concern right now, which maybe makes me sound like a bimbo, but that's all that I'm thinking about and just letting everything else flow naturally."

Her panic would often arise when writing with an artist she had never worked with, and she didn't feel comfortable. "I think I do still have a massive insecurity complex about the idea of being a pop star, because I've always been in this weird to-and-fro sort of place. And I'm just beginning to realise that I am the person who is just a bit scruffy and doing all the wrong things at the wrong time. That's when I get panicky – when I work with a wrong person and can't voice my own opinion."

There's a sense that she is fearful for the future, too, worrying that her anxiety might become more intense. "It's probably going to get worse now I have three days off [this year]. It's going to be really hyper to totally non-hyper and depressed."

Is she a manic person?

"Yes. Yes. I feel like I can be six different people in one day sometimes. Which is fun but also really strange in my own brain. Because I'll surprise myself sometimes with things that come out of my mouth and musically, but maybe that's nice also. But I'm 21. I don't know if people really know who they are until they're dead anyway. You die and you're like: 'I got it! And now I'm dead!'"

So what if Fancy and Boom Clap don't take her to the next level? What happens if people lose interest in her career as a solo artist? She says she doesn't care, but her answer is tinged with caution. "I'm cool with that. I'm just chilling, I guess. If it does happen, I'm not dying for it to happen. I'm not sitting here like: 'This is it, this is my life!' That's what I was like when I was 15. I was like: 'I've signed a record deal and now I'm going to be Britney Spears.' Which obviously is not how it works unless you are Britney Spears.

"Obviously I want it to work. I want everybody in the whole world to have heard my album instead of 30,000 people, but at the same time I'm just happy daydreaming. I'll still write for big artists but I have stuff I want to say now. And that's what's most important to me. I really believe that will happen, I believe in karma and I believe in hard work and I don't believe in like, I don't know."

Her thoughts change tack. "I believe I deserve this. I believe I deserve everything that could maybe happen. And I don't think that's a cocky thing to say because I've worked really hard and I've never bitten the hand that fed me and I've always been really respectful. Maybe that's a bad answer. Maybe I should be like I'm already a pop star!"

Then she exclaims, as if she's just realised: "I kind of am, aren't I? I am!"

And finally, one last, slightly calmer Charli emerges, apologising politely. "Sorry if that was a bit hectic."

• Boom Clap is out now on Atlantic