A hotel is a place you rent for a short time. You may visit another city and stay for 3 nights in a hotel while you are sight-seeing. A hotel room is also accessed by an internal hallway as opposed to a motel (motor hotel) where you drive up near the door of your room and enter from the outside.
An inn is another word for a hotel. Traditionally an inn is a smaller hotel with a restaurant and a few rooms, but now it can be the same as a hotel.
An apartment is a place where you live permanently. It may look like a hotel on the outside but it has a full kitchen and you pay rent every month to continue to live in the building.