In this paper, we propose a novel method to learn motion patterns and detect anomalies by human trajectory analysis. Human trajectories are various, for example, moving, roaming, pausing, and so on. But, current approaches for the analysis of motion patterns are effective only in understanding simple trajectories. We aim to understand complicated human trajectories with long-term observation. To deal with spatial and temporal features of trajectories, we employ HMM (Hidden Markov Model) to model time-series features of human positions. Next, a similarity matrix of HMM mutual distances is formed. MDS (Multi-Dimensional Scaling) based on eigenvector decomposition provides projected coordinates of trajectories in low-dimensional space. Then we apply k-means clustering to projected data in order to acquire human motion patterns. Anomalies can be detected by the use of likelihood scores for HMM representing motion patterns. We tested the proposed method by real-world trajectories data observed in a small store. Experimental result shows that our method accurately finds typical motion patterns and unusual trajectories.