Imagine this - if heaven and hell got swapped around, all the good people going to hell, all the bad people going to heaven. What would you do? That would be a real catch 22. Would you really want to live a good life, the kind of life that would get you sent to hell?
Of course, no such situation is possible, it is purely hypothetical because God would never make something like that. It’s sort of an axiom of the universe, because the promise of heaven is something that gives us the hope and strength to get through this life when times are hard. The point is that anything we do to ‘get into heaven’ is in fact a good thing, something that God would want us to do. So God has no problem with that being motivation for our actions.
Someone mentioned perfect and imperfect contrition, and it is worth mentioning that imperfect contrition (being sorry for your sins because by them you lose heaven) is actually sufficient for a valid reconciliation and forgiveness of your sins.
This doesn’t mean that we can always be thinking of ourselves, because in order to get into heaven we need to love others, understand their needs and put them first. However, doing good for others is never an excuse to sin, because God comes before others. So in doing good for others, we might sacrifice a lot in terms of physically but we never sacrifice anything spiritually, we never put our souls in danger. By always putting God first, as a result we are in fact always putting our attempts to get into heaven first.
The clincher, though, is this - even Jesus makes this distinction between selfishness for physical things and “selfishness” for wanting to get into heaven. He says to not store up treasure for ourselves on earth where moth and rust destroy, but to store up treasure for ourselves in heaven. Jesus actually tells us to store up treasure - something we would normally equate with selfishness, but when it comes to spiritual things, we have got permission from God himself.
Never feel selfish for wanting to get into heaven.