Ian Thorpe began his long and lonely return to the pool a year ago this month. He understands the solitary nature of elite sport better than most professional athletes, and describes its impact with layered elegance, but even Thorpe was jolted by the isolation he felt as he prepared to swim competitively again in Singapore last November. After four years in retirement, his five Olympic gold medals and famous old Thorpedo racing persona meant nothing as he climbed on the blocks.

"I've never felt more alone than in that moment," Thorpe says simply. "The water is normally my space – because I get quite territorial. But I realised that, despite all my training, I was about to put myself back out there as a competitor. I was surrounded by people but I still had this intense loneliness. Sport can sometimes isolate you and I've come to realise through all the travelling and all the hotel rooms that there is this recurring Lost In Translation moment."

It's typical of Thorpe, and an example of why he is so interesting to interview, that he should refer to Sofia Coppola's film amid his explanation of a difficult sporting comeback. In Lost in Translation, Bill Murray plays the part of a fading actor who suddenly confronts his acute loneliness and alienation in a Tokyo hotel. Thorpe, however, has ended up in far darker and more frightening places.

The 30-year-old's attempt to swim for Australia at this summer's London Olympics ended in disappointment. Yet set against his depression, which he has revealed for the first time in his stark but powerful new book, Thorpe's return assumes fresh meaning. "In terms of making the Olympics it was a complete failure," Thorpe concedes, as he reflects on his non-selection, "but I've rediscovered what I loved about my sport when I walked away from it, loathing it. I find such beauty in the repetition of training – in its rhythms and rituals. I had lost that. But, even if I prefer training to racing, part of me wants performance. It's less about winning than turning in a performance that matches my preparation."

Such purity ensured that Thorpe resumed training as soon as his stint as a BBC commentator at London 2012 ended in August. He plans to swim at next year's world championships in Barcelona and at Glasgow's 2014 Commonwealth Games – while possibly continuing two years beyond that at one last Olympic Games in Rio. Following the return of a former great sportsman is always poignant but, with Thorpe, there is a sense that swimming also provides a refuge from depression.

"There are some mornings when, if I didn't have the routine of training, I would struggle to get out of bed. But, when you get to training, all of a sudden things seem a little better. Of course racing can bring about increased pressure. But when I'm racing I usually manage my depression and anxiety really well. The pulse of anxiety is appropriate then. It's just more troubling on ordinary days."

Thorpe thinks carefully before he answers most questions. And his pause is especially considered when asked to describe his worst days of depression. He eventually offers a telling account which uncovers the extent to which depression can be physically, as well as well as psychologically, debilitating. "It's like a weight is pressing down on you. There are days when you just can't get out of bed. You cannot face the world. You tell yourself simple things like: 'Just get to the kitchen and get a glass of water.' But not being able to do something so basic is frightening.

"There were lots of times where I just could not bear to leave the house. You actually scour the cupboards for food. You become quite resourceful with what's left. And if there's nothing in the cupboards you just don't eat. Sometimes this feeling lasts just days. Other times it can be weeks. But you learn to identify the triggers. You can start to minimise the length of your depression.

"I realise now when I start to withdraw from doing things with my friends that I need to force myself. My doctors say [Thorpe emits a dry laugh]: 'Fake it till you make it.' So even if I don't feel like going out with my friends I know I need to. It's tough but, once you've forced yourself, it doesn't seem so bad and you can minimise the low."

Courage is needed to address such problems and Thorpe, who is an intensely private man, makes it seem as if "the cancer of attention" had contributed to his depression. So how was he finally able to voice a secret he had harboured so long? "It helped knowing doctors don't talk. It's also realising you need help. I still don't understand it entirely but being able to share it has helped because part of being depressed is being completely irrational. It's important to apply some rational thought.

"I think depression is genetic and I probably would've dealt with it whether I was famous or not. But people sometimes don't think you have a right to feel like this because you've been famous or successful. It just doesn't work like that. You can be a really great athlete and have all the attributes of mental toughness but, in real life, it doesn't work. I was really tough when I raced but I couldn't hold the rest of my life together."

Thorpe had been a world champion at 15, and won three gold medals at his home Olympics in Sydney in 2000. Yet a year later, and only 19, his illness had become so "crushing" Thorpe needed clandestine psychiatric help. He still could not bring himself to tell his friends or family and the unbearable weight continued to bear down on him. He finally contemplated suicide.

"It made me understand I needed to see someone more frequently and to get medication that worked. I feel I'm on to the other side of it now. I've got a handle on it but I would never say I'm in control of it because I know how quickly it can change. But I'm in a place where, for the first time, I'm comfortable talking about depression."

Does Thorpe believe that discussing his illness will diminish its hold on him? "I'm not sure. I assume it's better I'm not bottling it up. But it also means I've exposed myself."

It's hard to shake the assumption that Thorpe's demons have been deepened by media hounding and speculation about his sexuality. In one telling anecdote he writes of how the mother of Grant Hackett, another famous Australian swimmer, spoke of her sadness when she saw how he walked with his head lowered in public. Thorpe, in contrast, felt a burst of empathy with Hackett. "You feel you have to hide yourself," Thorpe says. "I don't want people to feel sorry for me but that's what fame is. Sometimes it's incredibly difficult to deal with and sometimes it's great. It's just not simple."

Thorpe was friends with Heath Ledger, the gifted Australian actor, and his partner, the actress Michelle Williams. A few years after his success in Brokeback Mountain, Ledger died after an accidental overdose. Just like Thorpe, he had struggled with depression and an intrusive Australian media.

"We had some interesting discussions around fame," Thorpe says. "What fame is and how we felt about it. But the last time I saw Heath we spoke of the summer we'd all just had as 'the happy summer'. It seemed as if everything was great for all of us. But things changed very quickly for him."

Was Ledger aware of the pressure Thorpe also faced? "Of course," Thorpe chides gently. "He liked sport and he was from Australia, so come on!"

Innuendos about Thorpe's sexuality began when he was a boy – and he remembers first being asked if he was gay in an interview when he was only 15. Thorpe insists in his book that, "for the record, I am not gay and all my sexual experiences have been straight". He argues that his interests in fashion and art and "beautiful things" have led to mistaken assumptions about him. His sexuality really doesn't matter but he then makes a sad aside: "The truth is I've spent most of my adult life trying to avoid relationships … if people get too close to me I often end up pushing them away."

But Thorpe provides a cautionary suggestion which can be applied to his private life. "The world is a lovely shade of grey and there needs to be more balance in the way lives are described. I know people need certain results to stay in their job so things get exaggerated in the media. It often seems as if there is not much else besides success and misery. I think what happens is that people in my position don't give out all the information because there is not enough trust. They don't want it to be sensationalised.

"I look at athletes and I see what they have to offer but they never reveal it in public. I see textbook media answers where I am just frightened by how boring it is. But they're scared to show themselves. We need to get back some trust between the media and athletes."

Australia's media can be hysterical in its treatment of sporting failure. Thorpe raises an eyebrow when I read to him some reports from the London Olympics which described James Magnussen's silver in the 100m freestyle as "the biggest Australian flop since Crocodile Dundee 3" and the failure of him and his team-mates to win a medal in the relay as "the biggest defeat since Gallipoli". Thorpe shrugs: "We should not be talking about sport in this way. But he had talked his prospects up a lot and when you do that you have to deliver. If he had won we would've accepted that this is the way he talks – like an American track-and-field sprinter. But because he didn't swim very well he invited that upon himself. Of course it's still exaggerated because we're talking about sport and not war."

Thorpe is different to most sportsmen and yet, for all his refined interests and sometimes fragile personality, he retains a hard competitive edge. "A driven part of me loves elite performance and I may be able to capture that again. I want to swim as well as I used to and if I do that it would mean winning medals again. If I get to a point in training where I don't think that's achievable I'll have to rethink everything. In 2016, at the Rio Olympics, I'll be 33. It's completely feasible I could swim there. But I'm taking it step by step. We have trials for the 2013 world championships in April. That's my next big goal.

"Before the London trials I did times in training I'd never done but I need consistency. So that's why big blocks of training are important. I just want to get back in the pool and train hard and that eagerness makes me realise how much I want it. It's helping me as a person and who knows where I'll end up as a swimmer. I'm excited to find out – and that's not something I could have said a few years ago."

Ian Thorpe's autobiography, This Is Me (Simon & Schuster), is available from the Guardian Bookshop, priced at £16 (RRP £20).