On your turn you place a tile. After placing the tile you can place your meeple onto any uncontrolled feature on that tile. After placing meeples, all completed features are scored.
Assuming that you are trying to gain some control of a controlled city
Let's assume the situation is this:
In the situation that you have presented you have placed your tile to close a city. Once that tile is placed, looking at the board, it is already controlled by another meeple, therefore you cannot place a meeple there.
To take some control of a city requires two moves. The first is to place a tile that is not connected to the city that you want to control, separated by a single tile space from the city and place a meeple on that city. On a later turn, play a tile that connects the main city to the small city you created on the previous tile.
This would give blue and red equal control, splitting the points. To take complete control would require you to perform this step again. (Or a big meeple from Inns and Cathedrals)
Assuming that the feature is uncontrolled.
Place the tile. The city is uncontrolled, so place a meeple. Score the completed city.