He builds her from spare parts and keeps on refining her. Eventually the female computer becomes jealous and isolates the young man from his friends. She has him in a penthouse and locks all the doors. A fire breaks out and his friends try to rescue him.
This sounds like Lincoln Child's book Death Match. It's about a matchmaking service that uses advanced AI to pair people together. The AI takes steps to eliminate people who are good matches with her creator. There is a fire, and the creator of the AI does live in a penthouse at the top of the matchmaking service's office tower.